diff --git a/classes/Config.php b/classes/Config.php index 5edf12b..1e8e9a1 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -141,9 +141,10 @@ class Config /** * Throw an exception if some of the options are invalid. * - * @return void * @throws Exception If youtube-dl is missing * @throws Exception If Python is missing + * + * @return void */ private function validateOptions() { @@ -223,8 +224,8 @@ class Config /** * Manually set some options. * - * @param array $options Options (see `config/config.example.yml` for available options) - * @param boolean $update True to update an existing instance + * @param array $options Options (see `config/config.example.yml` for available options) + * @param bool $update True to update an existing instance */ public static function setOptions(array $options, $update = true) { diff --git a/classes/PlaylistArchiveStream.php b/classes/PlaylistArchiveStream.php index a702de1..4d9c3c0 100644 --- a/classes/PlaylistArchiveStream.php +++ b/classes/PlaylistArchiveStream.php @@ -8,8 +8,6 @@ namespace Alltube; use Barracuda\ArchiveStream\TarArchive; use GuzzleHttp\Psr7\Stream; use Psr\Http\Message\StreamInterface; -use RuntimeException; -use stdClass; /** * Class used to create a Tar archive from playlists and stream it to the browser. @@ -41,6 +39,7 @@ class PlaylistArchiveStream extends TarArchive implements StreamInterface /** * True if the archive is complete. + * * @var bool */ private $isComplete = false; diff --git a/classes/Video.php b/classes/Video.php index 4d52539..9c60a4b 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -26,19 +26,22 @@ class Video private $config; /** - * URL of the page containing the video + * URL of the page containing the video. + * * @var string */ private $webpageUrl; /** - * Requested video format + * Requested video format. + * * @var string */ private $requestedFormat; /** - * Password + * Password. + * * @var string */ private $password; @@ -68,6 +71,7 @@ class Video private function getProcess(array $arguments) { $config = Config::getInstance(); + return new Process( array_merge( [$config->python, $config->youtubedl], @@ -90,7 +94,7 @@ class Video /** * Get a property from youtube-dl. * - * @param string $prop Property + * @param string $prop Property * * @throws PasswordException If the video is protected by a password and no password was specified * @throws Exception If the password is wrong @@ -172,7 +176,7 @@ class Video * * @param string $name Property * - * @return boolean + * @return bool */ public function __isset($name) { @@ -281,11 +285,11 @@ class Video /** * Get a process that runs avconv in order to convert a video. * - * @param int $audioBitrate Audio bitrate of the converted file - * @param string $filetype Filetype of the converted file - * @param bool $audioOnly True to return an audio-only file - * @param string $from Start the conversion at this time - * @param string $to End the conversion at this time + * @param int $audioBitrate Audio bitrate of the converted file + * @param string $filetype Filetype of the converted file + * @param bool $audioOnly True to return an audio-only file + * @param string $from Start the conversion at this time + * @param string $to End the conversion at this time * * @throws Exception If avconv/ffmpeg is missing * @@ -353,8 +357,8 @@ class Video /** * Get audio stream of converted video. * - * @param string $from Start the conversion at this time - * @param string $to End the conversion at this time + * @param string $from Start the conversion at this time + * @param string $to End the conversion at this time * * @throws Exception If your try to convert an M3U8 video * @throws Exception If the popen stream was not created correctly @@ -526,7 +530,7 @@ class Video */ public function withFormat($format) { - return new Video($this->webpageUrl, $format, $this->password); + return new self($this->webpageUrl, $format, $this->password); } /** diff --git a/tests/BaseTest.php b/tests/BaseTest.php index c70756b..ab76316 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -6,18 +6,13 @@ namespace Alltube\Test; use Alltube\Config; -use Alltube\Video; -use Alltube\PlaylistArchiveStream; use PHPUnit\Framework\TestCase; -use RuntimeException; -use stdClass; /** * Unit tests for the ViewFactory class. */ abstract class BaseTest extends TestCase { - /** * Prepare tests. */ diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index ffedca2..ac6189c 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -6,7 +6,6 @@ namespace Alltube\Test; use Alltube\Config; -use PHPUnit\Framework\TestCase; /** * Unit tests for the Config class. @@ -132,7 +131,6 @@ class ConfigTest extends BaseTest Config::setOptions(['python' => 'foo']); } - /** * Test the getInstance function with the CONVERT and PYTHON environment variables. * diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index f8cfa02..5193f0e 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -10,7 +10,6 @@ use Alltube\Controller\FrontController; use Alltube\LocaleManager; use Alltube\ViewFactory; use Exception; -use PHPUnit\Framework\TestCase; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; diff --git a/tests/LocaleManagerTest.php b/tests/LocaleManagerTest.php index aab0463..6ebb1b2 100644 --- a/tests/LocaleManagerTest.php +++ b/tests/LocaleManagerTest.php @@ -7,7 +7,6 @@ namespace Alltube\Test; use Alltube\Locale; use Alltube\LocaleManager; -use PHPUnit\Framework\TestCase; /** * Unit tests for the LocaleManagerTest class. diff --git a/tests/LocaleMiddlewareTest.php b/tests/LocaleMiddlewareTest.php index a8f45b4..0be9f43 100644 --- a/tests/LocaleMiddlewareTest.php +++ b/tests/LocaleMiddlewareTest.php @@ -8,7 +8,6 @@ namespace Alltube\Test; use Alltube\Locale; use Alltube\LocaleManager; use Alltube\LocaleMiddleware; -use PHPUnit\Framework\TestCase; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; diff --git a/tests/LocaleTest.php b/tests/LocaleTest.php index f425fe0..6e429fd 100644 --- a/tests/LocaleTest.php +++ b/tests/LocaleTest.php @@ -6,7 +6,6 @@ namespace Alltube\Test; use Alltube\Locale; -use PHPUnit\Framework\TestCase; /** * Unit tests for the LocaleTest class. diff --git a/tests/PlaylistArchiveStreamTest.php b/tests/PlaylistArchiveStreamTest.php index fc34fe3..63980f2 100644 --- a/tests/PlaylistArchiveStreamTest.php +++ b/tests/PlaylistArchiveStreamTest.php @@ -5,12 +5,8 @@ namespace Alltube\Test; -use Alltube\Config; -use Alltube\Video; use Alltube\PlaylistArchiveStream; -use PHPUnit\Framework\TestCase; -use RuntimeException; -use stdClass; +use Alltube\Video; /** * Unit tests for the ViewFactory class. diff --git a/tests/UglyRouterTest.php b/tests/UglyRouterTest.php index fb26a61..3609db8 100644 --- a/tests/UglyRouterTest.php +++ b/tests/UglyRouterTest.php @@ -6,7 +6,6 @@ namespace Alltube\Test; use Alltube\UglyRouter; -use PHPUnit\Framework\TestCase; use Slim\Http\Environment; use Slim\Http\Request; diff --git a/tests/VideoStubsTest.php b/tests/VideoStubsTest.php index 07ca0fe..0b96139 100644 --- a/tests/VideoStubsTest.php +++ b/tests/VideoStubsTest.php @@ -5,11 +5,9 @@ namespace Alltube\Test; -use Alltube\Config; use Alltube\Video; use Mockery; use phpmock\mockery\PHPMockery; -use PHPUnit\Framework\TestCase; /** * Unit tests for the Video class. diff --git a/tests/VideoTest.php b/tests/VideoTest.php index 64f125f..48bb7e6 100644 --- a/tests/VideoTest.php +++ b/tests/VideoTest.php @@ -7,14 +7,12 @@ namespace Alltube\Test; use Alltube\Config; use Alltube\Video; -use PHPUnit\Framework\TestCase; /** * Unit tests for the Video class. */ class VideoTest extends BaseTest { - /** * Test getExtractors function. * diff --git a/tests/ViewFactoryTest.php b/tests/ViewFactoryTest.php index df1358c..c73a3b4 100644 --- a/tests/ViewFactoryTest.php +++ b/tests/ViewFactoryTest.php @@ -6,7 +6,6 @@ namespace Alltube\Test; use Alltube\ViewFactory; -use PHPUnit\Framework\TestCase; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request;