From f100d9ae720ea90b91387366dd3559f178d4f6d2 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Tue, 13 May 2025 14:22:48 +0800 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D1=91=D0=BD=20=D0=BC?= =?UTF-8?q?=D1=91=D1=80=D1=82=D0=B2=D1=8B=D0=B9=20=D0=BA=D0=BE=D0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 --- app/Controllers/WebController.php | 1 + app/Core/IniFile.php | 5 ----- app/Core/Kernel.php | 16 --------------- app/Core/TwigExtention.php | 3 +-- app/Middleware/RequestId.php | 34 ------------------------------- app/helpers.php | 11 ---------- config/http.php | 29 -------------------------- 8 files changed, 2 insertions(+), 100 deletions(-) delete mode 100644 app/Middleware/RequestId.php delete mode 100644 config/http.php diff --git a/.env.example b/.env.example index e6dfed8..2707157 100644 --- a/.env.example +++ b/.env.example @@ -10,9 +10,6 @@ APP_TITLE="IPTV Плейлисты" APP_TIMEZONE=Europe/Moscow PAGE_SIZE=10 -# config/http.php -USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36" - # config/cache.php CACHE_HOST="keydb" CACHE_PORT=6379 diff --git a/app/Controllers/WebController.php b/app/Controllers/WebController.php index f07a1ea..c2b6622 100644 --- a/app/Controllers/WebController.php +++ b/app/Controllers/WebController.php @@ -109,6 +109,7 @@ class WebController extends BasicController * @throws LoaderError * @throws RuntimeError * @throws SyntaxError + * @throws Exception */ public function details(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { diff --git a/app/Core/IniFile.php b/app/Core/IniFile.php index d662ffd..f319c3b 100644 --- a/app/Core/IniFile.php +++ b/app/Core/IniFile.php @@ -17,11 +17,6 @@ use Exception; */ class IniFile { - /** - * @var array Считанное из файла содержимое ini-файла - */ - protected array $ini; - /** * @var array[] Коллекция подгруженных плейлистов */ diff --git a/app/Core/Kernel.php b/app/Core/Kernel.php index 24f479f..a30accc 100644 --- a/app/Core/Kernel.php +++ b/app/Core/Kernel.php @@ -11,7 +11,6 @@ namespace App\Core; use App\Core\TwigExtention as IptvTwigExtension; use Dotenv\Dotenv; -use GuzzleHttp\Client; use InvalidArgumentException; use Redis; use Slim\App; @@ -56,11 +55,6 @@ final class Kernel */ protected ?Redis $cache = null; - /** - * @var Client|null - */ - protected ?Client $httpClient = null; - /** * Закрытый конструктор * @@ -198,16 +192,6 @@ final class Kernel return $this->cache; } - /** - * Возвращает объект http-клиента - * - * @return Client - */ - public function guzzle(): Client - { - return $this->httpClient ??= new Client($this->config['http']); - } - /** * Возвращает значение из конфига * diff --git a/app/Core/TwigExtention.php b/app/Core/TwigExtention.php index c1d0060..45851cc 100644 --- a/app/Core/TwigExtention.php +++ b/app/Core/TwigExtention.php @@ -9,7 +9,6 @@ declare(strict_types=1); namespace App\Core; -use Twig\Error\LoaderError; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -20,6 +19,7 @@ class TwigExtention extends AbstractExtension { /** * @inheritDoc + * @noinspection PhpUnused */ public function getFunctions(): array { @@ -38,7 +38,6 @@ class TwigExtention extends AbstractExtension * @param string $key Ключ в формате "config.key" * @param mixed|null $default Значение по умолчанию * @return mixed - * @throws LoaderError */ public function config(string $key, mixed $default = null): mixed { diff --git a/app/Middleware/RequestId.php b/app/Middleware/RequestId.php deleted file mode 100644 index 59ca5d8..0000000 --- a/app/Middleware/RequestId.php +++ /dev/null @@ -1,34 +0,0 @@ -withHeader('X-Request-ID', uniqid()); - - return $handler->handle($request); - } -} diff --git a/app/helpers.php b/app/helpers.php index 5ef0d9a..c3d2573 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -44,17 +44,6 @@ function cache_path(string $path = ''): string return root_path("cache/$path"); } -/** - * Returns path to app views - * - * @param string $path - * @return string - */ -function views_path(string $path = ''): string -{ - return root_path("views/$path"); -} - /** * Returns base URL * diff --git a/config/http.php b/config/http.php deleted file mode 100644 index 3f57b25..0000000 --- a/config/http.php +++ /dev/null @@ -1,29 +0,0 @@ - env('APP_URL', 'http://localhost:8080'), - 'timeout' => 25, - 'connect_timeout' => 7, - 'http_errors' => true, - 'synchronous' => false, - 'headers' => [ - 'User-Agent' => env('USER_AGENT'), - ], - 'allow_redirects' => [ - 'max' => 5, - 'strict' => false, - 'referer' => false, - 'protocols' => ['http', 'https'], - 'track_redirects' => false - ] -];