From 61cb73dc5916b9cf0c64f9ce2970433bbb99d5ce Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sun, 21 Apr 2019 19:47:30 +0200 Subject: [PATCH] refactor: Fix some types and unused variables --- classes/PlaylistArchiveStream.php | 2 +- classes/Video.php | 14 ++++++++------ controllers/FrontController.php | 1 - tests/ConfigTest.php | 8 +++++--- tests/FrontControllerTest.php | 7 ------- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/classes/PlaylistArchiveStream.php b/classes/PlaylistArchiveStream.php index 4d9c3c0..3675595 100644 --- a/classes/PlaylistArchiveStream.php +++ b/classes/PlaylistArchiveStream.php @@ -156,7 +156,7 @@ class PlaylistArchiveStream extends TarArchive implements StreamInterface * * @param string $key string $key Specific metadata to retrieve. * - * @return null + * @return array|mixed|null */ public function getMetadata($key = null) { diff --git a/classes/Video.php b/classes/Video.php index e39decb..63a1913 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -16,12 +16,14 @@ use Symfony\Component\Process\Process; * * Due to the way youtube-dl behaves, this class can also contain information about a playlist. * - * @property-read string $title Title - * @property-read string $protocol Network protocol (HTTP, RTMP, etc.) - * @property-read string $url File URL - * @property-read string $ext File extension - * @property-read string $extractor_key youtube-dl extractor class used - * @property-read array $entries List of videos (if the object contains information about a playlist) + * @property-read string $title Title + * @property-read string $protocol Network protocol (HTTP, RTMP, etc.) + * @property-read string $url File URL + * @property-read string $ext File extension + * @property-read string $extractor_key youtube-dl extractor class used + * @property-read array $entries List of videos (if the object contains information about a playlist) + * @property-read array $rtmp_conn + * @property-read string|null $_type Object type (usually "playlist" or null) */ class Video { diff --git a/controllers/FrontController.php b/controllers/FrontController.php index f7cee45..b420b95 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -442,7 +442,6 @@ class FrontController if ($request->isGet()) { $response = $response->withBody(new Stream($stream)); } - $webpageUrl = $request->getQueryParam('url'); return $response->withHeader( 'Content-Disposition', diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index e8141c6..6480521 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -36,8 +36,9 @@ class ConfigTest extends BaseTest */ public function testGetInstance() { - $this->assertEquals($this->config->convert, false); - $this->assertConfig($this->config); + $config = Config::getInstance(); + $this->assertEquals($config->convert, false); + $this->assertConfig($config); } /** @@ -67,7 +68,8 @@ class ConfigTest extends BaseTest */ public function testSetFile() { - $this->assertNull(Config::setFile($this->getConfigFile())); + Config::setFile($this->getConfigFile()); + $this->assertConfig($this->config); } /** diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index 5193f0e..30f703b 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -48,13 +48,6 @@ class FrontControllerTest extends BaseTest */ private $controller; - /** - * Config class instance. - * - * @var Config - */ - private $config; - /** * Prepare tests. */