diff --git a/.htaccess b/.htaccess index bd361a4..4b254b0 100644 --- a/.htaccess +++ b/.htaccess @@ -26,7 +26,9 @@ FileETag None - AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype + + AddOutputFilterByType DEFLATE text/css text/html application/javascript font/truetype + diff --git a/.travis.yml b/.travis.yml index 2347cff..c3316a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,10 @@ language: php php: 7.3 addons: - apt: - packages: - - language-pack-fr + apt: + packages: + - language-pack-fr install: composer install --no-progress script: - - composer lint - - composer test + - composer lint + - composer test diff --git a/classes/Config.php b/classes/Config.php index 270d394..c68d5b3 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -7,6 +7,7 @@ namespace Alltube; use Exception; +use Jawira\CaseConverter\CaseConverterException; use Symfony\Component\Yaml\Yaml; use Jawira\CaseConverter\Convert; @@ -39,7 +40,7 @@ class Config /** * youtube-dl parameters. * - * @var array + * @var string[] */ public $params = ['--no-warnings', '--ignore-errors', '--flat-playlist', '--restrict-filenames', '--no-playlist']; @@ -60,7 +61,7 @@ class Config /** * List of formats available in advanced conversion mode. * - * @var array + * @var string[] */ public $convertAdvancedFormats = ['mp3', 'avi', 'flv', 'wav']; @@ -121,17 +122,10 @@ class Config */ public $appName = 'AllTube Download'; - /** - * YAML config file path. - * - * @var string - */ - private $file; - /** * Generic formats supported by youtube-dl. * - * @var array + * @var string[] */ public $genericFormats = []; @@ -145,7 +139,8 @@ class Config /** * Config constructor. * - * @param array $options Options + * @param mixed[] $options Options + * @throws CaseConverterException */ private function __construct(array $options = []) { @@ -156,9 +151,9 @@ class Config if (empty($this->genericFormats)) { // We don't put this in the class definition so it can be detected by xgettext. $this->genericFormats = [ - 'best' => $localeManager->t('Best'), + 'best' => $localeManager->t('Best'), 'bestvideo+bestaudio' => $localeManager->t('Remux best video with best audio'), - 'worst' => $localeManager->t('Worst'), + 'worst' => $localeManager->t('Worst'), ]; } @@ -195,10 +190,10 @@ class Config /** * Throw an exception if some of the options are invalid. * - * @throws Exception If youtube-dl is missing + * @return void * @throws Exception If Python is missing * - * @return void + * @throws Exception If youtube-dl is missing */ private function validateOptions() { @@ -216,7 +211,7 @@ class Config /** * Apply the provided options. * - * @param array $options Options + * @param mixed[] $options Options * * @return void */ @@ -235,6 +230,7 @@ class Config * If the value is an array, you should use the YAML format: "CONVERT_ADVANCED_FORMATS='[foo, bar]'" * * @return void + * @throws CaseConverterException */ private function getEnv() { @@ -265,11 +261,13 @@ class Config * Set options from a YAML file. * * @param string $file Path to the YAML file + * @return void + * @throws Exception */ public static function setFile($file) { if (is_file($file)) { - $options = Yaml::parse(file_get_contents($file)); + $options = Yaml::parse(strval(file_get_contents($file))); self::$instance = new self($options); self::$instance->validateOptions(); } else { @@ -280,8 +278,10 @@ class Config /** * Manually set some options. * - * @param array $options Options (see `config/config.example.yml` for available options) - * @param bool $update True to update an existing instance + * @param mixed[] $options Options (see `config/config.example.yml` for available options) + * @param bool $update True to update an existing instance + * @return void + * @throws Exception */ public static function setOptions(array $options, $update = true) { diff --git a/classes/Locale.php b/classes/Locale.php index 50e9055..f8ebf2f 100644 --- a/classes/Locale.php +++ b/classes/Locale.php @@ -104,12 +104,14 @@ class Locale /** * Get country information from locale. * - * @return Country|array + * @return Country|Country[]|null */ public function getCountry() { if (isset($this->region)) { return country($this->getIso3166()); } + + return null; } } diff --git a/classes/LocaleManager.php b/classes/LocaleManager.php index e34e6f5..813ea79 100644 --- a/classes/LocaleManager.php +++ b/classes/LocaleManager.php @@ -7,7 +7,6 @@ namespace Alltube; use Aura\Session\Segment; -use Symfony\Component\Process\Process; use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Loader\PoFileLoader; @@ -19,7 +18,7 @@ class LocaleManager /** * Supported locales. * - * @var array + * @var string[] */ private $supportedLocales = ['en_US', 'fr_FR', 'zh_CN', 'es_ES', 'pt_BR', 'de_DE', 'ar', 'pl_PL', 'tr_TR']; @@ -112,6 +111,7 @@ class LocaleManager * Set the current locale. * * @param Locale $locale Locale + * @return void */ public function setLocale(Locale $locale) { @@ -122,6 +122,7 @@ class LocaleManager /** * Unset the current locale. + * @return void */ public function unsetLocale() { @@ -133,8 +134,8 @@ class LocaleManager /** * Smarty "t" block. * - * @param array $params Block parameters - * @param string $text Block content + * @param mixed[] $params Block parameters + * @param string $text Block content * * @return string Translated string */ @@ -152,6 +153,7 @@ class LocaleManager * * @param string $string String to translate * + * @param mixed[] $params * @return string Translated string */ public function t($string, array $params = []) diff --git a/classes/LocaleMiddleware.php b/classes/LocaleMiddleware.php index f1ba610..b7395bd 100644 --- a/classes/LocaleMiddleware.php +++ b/classes/LocaleMiddleware.php @@ -36,9 +36,9 @@ class LocaleMiddleware /** * Test if a locale can be used for the current user. * - * @param array $proposedLocale Locale array created by AcceptLanguage::parse() + * @param mixed[] $proposedLocale Locale array created by AcceptLanguage::parse() * - * @return Locale Locale if chosen, nothing otherwise + * @return Locale|null Locale if chosen, nothing otherwise */ public function testLocale(array $proposedLocale) { @@ -52,14 +52,16 @@ class LocaleMiddleware return new Locale($proposedLocale['language'] . '_' . $proposedLocale['region']); } } + + return null; } /** * Main middleware function. * - * @param Request $request PSR request + * @param Request $request PSR request * @param Response $response PSR response - * @param callable $next Next middleware + * @param callable $next Next middleware * * @return Response */ diff --git a/classes/UglyRouter.php b/classes/UglyRouter.php index 89ec2bb..f03efe7 100644 --- a/classes/UglyRouter.php +++ b/classes/UglyRouter.php @@ -21,7 +21,7 @@ class UglyRouter extends Router * * @param ServerRequestInterface $request The current HTTP request object * - * @return array + * @return mixed[] * * @link https://github.com/nikic/FastRoute/blob/master/src/Dispatcher.php */ @@ -42,14 +42,14 @@ class UglyRouter extends Router /** * Build the path for a named route including the base path. * - * @param string $name Route name - * @param array $data Named argument replacement data - * @param array $queryParams Optional query string parameters - * - * @throws RuntimeException If named route does not exist - * @throws InvalidArgumentException If required data not provided + * @param string $name Route name + * @param string[] $data Named argument replacement data + * @param string[] $queryParams Optional query string parameters * * @return string + * @throws InvalidArgumentException If required data not provided + * + * @throws RuntimeException If named route does not exist */ public function pathFor($name, array $data = [], array $queryParams = []) { diff --git a/classes/Video.php b/classes/Video.php index 9c6adbf..f88a088 100644 --- a/classes/Video.php +++ b/classes/Video.php @@ -10,7 +10,7 @@ use Alltube\Exception\EmptyUrlException; use Alltube\Exception\PasswordException; use Exception; use GuzzleHttp\Client; -use GuzzleHttp\Psr7\Response; +use Psr\Http\Message\ResponseInterface; use stdClass; use Symfony\Component\Process\Process; @@ -19,16 +19,16 @@ 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 array $rtmp_conn + * @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) - * @property-read stdClass $downloader_options - * @property-read stdClass $http_headers + * @property-read stdClass $downloader_options + * @property-read stdClass $http_headers */ class Video { @@ -70,7 +70,7 @@ class Video /** * URLs of the video files. * - * @var array + * @var string[] */ private $urls; @@ -84,11 +84,11 @@ class Video /** * VideoDownload constructor. * - * @param string $webpageUrl URL of the page containing the video + * @param string $webpageUrl URL of the page containing the video * @param string $requestedFormat Requested video format * (can be any format string accepted by youtube-dl, * including selectors like "[height<=720]") - * @param string $password Password + * @param string $password Password */ public function __construct($webpageUrl, $requestedFormat = 'best', $password = null) { @@ -105,7 +105,7 @@ class Video * * @param string[] $arguments Arguments * - * @return Process + * @return Process */ private static function getProcess(array $arguments) { @@ -124,7 +124,9 @@ class Video * List all extractors. * * @return string[] Extractors - * */ + * + * @throws PasswordException + */ public static function getExtractors() { $video = new self(''); @@ -135,13 +137,13 @@ class Video /** * Call youtube-dl. * - * @param array $arguments Arguments + * @param string[] $arguments Arguments * - * @throws PasswordException If the video is protected by a password and no password was specified + * @return string Result * @throws Exception If the password is wrong * @throws Exception If youtube-dl returns an error * - * @return string Result + * @throws PasswordException If the video is protected by a password and no password was specified */ private function callYoutubedl(array $arguments) { @@ -153,7 +155,7 @@ class Video $process->run(); if (!$process->isSuccessful()) { $errorOutput = trim($process->getErrorOutput()); - $exitCode = $process->getExitCode(); + $exitCode = intval($process->getExitCode()); if ($errorOutput == 'ERROR: This video is protected by a password, use the --video-password option') { throw new PasswordException($errorOutput, $exitCode); } elseif (substr($errorOutput, 0, 21) == 'ERROR: Wrong password') { @@ -172,6 +174,7 @@ class Video * @param string $prop Property * * @return string + * @throws PasswordException */ private function getProp($prop = 'dump-json') { @@ -196,7 +199,9 @@ class Video * Get all information about a video. * * @return stdClass Decoded JSON - * */ + * + * @throws PasswordException + */ public function getJson() { if (!isset($this->json)) { @@ -212,12 +217,15 @@ class Video * @param string $name Property * * @return mixed + * @throws PasswordException */ public function __get($name) { if (isset($this->$name)) { return $this->getJson()->$name; } + + return null; } /** @@ -226,6 +234,7 @@ class Video * @param string $name Property * * @return bool + * @throws PasswordException */ public function __isset($name) { @@ -240,7 +249,9 @@ class Video * (eg. bestvideo+bestaudio). * * @return string[] URLs of video - * */ + * @throws EmptyUrlException + * @throws PasswordException + */ public function getUrl() { // Cache the URLs. @@ -259,7 +270,9 @@ class Video * Get filename of video file from URL of page. * * @return string Filename of extracted video - * */ + * + * @throws PasswordException + */ public function getFilename() { return trim($this->getProp('get-filename')); @@ -271,23 +284,17 @@ class Video * @param string $extension New file extension * * @return string Filename of extracted video with specified extension + * @throws PasswordException */ public function getFileNameWithExtension($extension) { - return html_entity_decode( - pathinfo( - $this->getFilename(), - PATHINFO_FILENAME - ) . '.' . $extension, - ENT_COMPAT, - 'ISO-8859-1' - ); + return str_replace('.' . $this->ext, '.' . $extension, $this->getFilename()); } /** * Return arguments used to run rtmp for a specific video. * - * @return array Arguments + * @return string[] Arguments */ private function getRtmpArguments() { @@ -296,12 +303,12 @@ class Video if ($this->protocol == 'rtmp') { foreach ( [ - 'url' => '-rtmp_tcurl', - 'webpage_url' => '-rtmp_pageurl', - 'player_url' => '-rtmp_swfverify', - 'flash_version' => '-rtmp_flashver', - 'play_path' => '-rtmp_playpath', - 'app' => '-rtmp_app', + 'url' => '-rtmp_tcurl', + 'webpage_url' => '-rtmp_pageurl', + 'player_url' => '-rtmp_swfverify', + 'flash_version' => '-rtmp_flashver', + 'play_path' => '-rtmp_playpath', + 'app' => '-rtmp_app', ] as $property => $option ) { if (isset($this->{$property})) { @@ -324,7 +331,7 @@ class Video /** * Check if a command runs successfully. * - * @param array $command Command and arguments + * @param string[] $command Command and arguments * * @return bool False if the command returns an error, true otherwise */ @@ -339,15 +346,15 @@ 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 * + * @return Process Process * @throws Exception If avconv/ffmpeg is missing * - * @return Process Process */ private function getAvconvProcess( $audioBitrate, @@ -418,12 +425,12 @@ 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 - * - * @throws Exception If your try to convert an M3U8 video - * @throws Exception If the popen stream was not created correctly + * @param string $to End the conversion at this time * * @return resource popen stream + * @throws Exception If the popen stream was not created correctly + * + * @throws Exception If your try to convert an M3U8 video */ public function getAudioStream($from = null, $to = null) { @@ -453,10 +460,10 @@ class Video /** * Get video stream from an M3U playlist. * - * @throws Exception If avconv/ffmpeg is missing + * @return resource popen stream * @throws Exception If the popen stream was not created correctly * - * @return resource popen stream + * @throws Exception If avconv/ffmpeg is missing */ public function getM3uStream() { @@ -495,9 +502,9 @@ class Video /** * Get an avconv stream to remux audio and video. * + * @return resource popen stream * @throws Exception If the popen stream was not created correctly * - * @return resource popen stream */ public function getRemuxStream() { @@ -532,9 +539,9 @@ class Video /** * Get video stream from an RTMP video. * + * @return resource popen stream * @throws Exception If the popen stream was not created correctly * - * @return resource popen stream */ public function getRtmpStream() { @@ -565,13 +572,13 @@ class Video /** * Get the stream of a converted video. * - * @param int $audioBitrate Audio bitrate of the converted file - * @param string $filetype Filetype of the converted file - * - * @throws Exception If your try to convert and M3U8 video - * @throws Exception If the popen stream was not created correctly + * @param int $audioBitrate Audio bitrate of the converted file + * @param string $filetype Filetype of the converted file * * @return resource popen stream + * @throws Exception If the popen stream was not created correctly + * + * @throws Exception If your try to convert and M3U8 video */ public function getConvertedStream($audioBitrate, $filetype) { @@ -605,21 +612,35 @@ class Video /** * Get a HTTP response containing the video. * - * @param array $headers HTTP headers of the request + * @param mixed[] $headers HTTP headers of the request * - * @return Response + * @return ResponseInterface + * @throws EmptyUrlException + * @throws PasswordException + * @link https://github.com/guzzle/guzzle/issues/2640 */ public function getHttpResponse(array $headers = []) { - $client = new Client(); + // IDN conversion breaks with Google hosts like https://r3---sn-25glene6.googlevideo.com/. + $client = new Client(['idn_conversion' => false]); $urls = $this->getUrl(); + $stream_context_options = []; + + if (array_key_exists('Referer', (array)$this->http_headers)) { + $stream_context_options = [ + 'http' => [ + 'header' => 'Referer: ' . $this->http_headers->Referer + ] + ]; + } return $client->request( 'GET', $urls[0], [ 'stream' => true, - 'headers' => array_merge((array) $this->http_headers, $headers) + 'stream_context' => $stream_context_options, + 'headers' => array_merge((array)$this->http_headers, $headers) ] ); } diff --git a/classes/ViewFactory.php b/classes/ViewFactory.php index 835b471..e5c0bb7 100644 --- a/classes/ViewFactory.php +++ b/classes/ViewFactory.php @@ -10,6 +10,7 @@ use Psr\Container\ContainerInterface; use Slim\Http\Request; use Slim\Views\Smarty; use Slim\Views\SmartyPlugins; +use SmartyException; /** * Create Smarty view object. @@ -20,14 +21,15 @@ class ViewFactory * Create Smarty view object. * * @param ContainerInterface $container Slim dependency container - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * * @return Smarty + * @throws SmartyException */ public static function create(ContainerInterface $container, Request $request = null) { if (!isset($request)) { - $request = $container['request']; + $request = $container->get('request'); } $view = new Smarty(__DIR__ . '/../templates/'); @@ -35,9 +37,10 @@ class ViewFactory $request = $request->withUri($request->getUri()->withScheme('https')->withPort(443)); } - $localeManager = $container['locale']; + /** @var LocaleManager $localeManager */ + $localeManager = $container->get('locale'); - $smartyPlugins = new SmartyPlugins($container['router'], $request->getUri()->withUserInfo(null)); + $smartyPlugins = new SmartyPlugins($container->get('router'), $request->getUri()->withUserInfo(null)); $view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']); $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']); $view->registerPlugin('block', 't', [$localeManager, 'smartyTranslate']); diff --git a/classes/streams/ConvertedPlaylistArchiveStream.php b/classes/streams/ConvertedPlaylistArchiveStream.php index fcc206c..c336663 100644 --- a/classes/streams/ConvertedPlaylistArchiveStream.php +++ b/classes/streams/ConvertedPlaylistArchiveStream.php @@ -7,6 +7,7 @@ namespace Alltube\Stream; use Alltube\Video; +use Exception; use Slim\Http\Stream; /** @@ -20,6 +21,7 @@ class ConvertedPlaylistArchiveStream extends PlaylistArchiveStream * @param Video $video Video to stream * * @return void + * @throws Exception */ protected function startVideoStream(Video $video) { diff --git a/classes/streams/PlaylistArchiveStream.php b/classes/streams/PlaylistArchiveStream.php index 7a0871e..2e682fb 100644 --- a/classes/streams/PlaylistArchiveStream.php +++ b/classes/streams/PlaylistArchiveStream.php @@ -6,6 +6,8 @@ namespace Alltube\Stream; +use Alltube\Exception\EmptyUrlException; +use Alltube\Exception\PasswordException; use Alltube\Video; use Barracuda\ArchiveStream\ZipArchive; use Psr\Http\Message\StreamInterface; @@ -48,7 +50,10 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface /** * PlaylistArchiveStream constructor. * + * We don't call the parent constructor because it messes up the output buffering. + * * @param Video $video Video/playlist to download + * @noinspection PhpMissingParentConstructorInspection */ public function __construct(Video $video) { @@ -86,20 +91,21 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * * @param string $string The string that is to be written * - * @return int + * @return int|false */ public function write($string) { - fwrite($this->buffer, $string); + return fwrite($this->buffer, $string); } /** * Get the size of the stream if known. * - * @return null + * @return int|null */ public function getSize() { + return null; } /** @@ -145,7 +151,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface /** * Returns the remaining contents in a string. * - * @return string + * @return string|false */ public function getContents() { @@ -170,6 +176,8 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface if (isset($meta[$key])) { return $meta[$key]; } + + return null; } /** @@ -194,7 +202,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface { $this->rewind(); - return $this->getContents(); + return strval($this->getContents()); } /** @@ -236,6 +244,8 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * @param Video $video Video to stream * * @return void + * @throws PasswordException + * @throws EmptyUrlException */ protected function startVideoStream(Video $video) { @@ -246,7 +256,7 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface $this->init_file_stream_transfer( $video->getFilename(), - $contentLengthHeaders[0] + intval($contentLengthHeaders[0]) ); } @@ -256,6 +266,8 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface * @param int $count Number of bytes to read * * @return string|false + * @throws EmptyUrlException + * @throws PasswordException */ public function read($count) { diff --git a/classes/streams/YoutubeChunkStream.php b/classes/streams/YoutubeChunkStream.php index 6328fb9..c99f422 100644 --- a/classes/streams/YoutubeChunkStream.php +++ b/classes/streams/YoutubeChunkStream.php @@ -6,7 +6,7 @@ namespace Alltube\Stream; -use GuzzleHttp\Psr7\Response; +use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; /** @@ -18,16 +18,16 @@ class YoutubeChunkStream implements StreamInterface /** * HTTP response containing the video chunk. * - * @var Response + * @var ResponseInterface */ private $response; /** * YoutubeChunkStream constructor. * - * @param Response $response HTTP response containing the video chunk + * @param ResponseInterface $response HTTP response containing the video chunk */ - public function __construct(Response $response) + public function __construct(ResponseInterface $response) { $this->response = $response; } @@ -41,7 +41,7 @@ class YoutubeChunkStream implements StreamInterface */ public function read($length) { - $size = $this->response->getHeader('Content-Length')[0]; + $size = intval($this->response->getHeader('Content-Length')[0]); if ($size - $this->tell() < $length) { // Don't try to read further than the end of the stream. $length = $size - $this->tell(); @@ -55,7 +55,7 @@ class YoutubeChunkStream implements StreamInterface */ public function __toString() { - return (string) $this->response->getBody(); + return (string)$this->response->getBody(); } /** @@ -124,21 +124,21 @@ class YoutubeChunkStream implements StreamInterface * @param int $offset Stream offset * @param int $whence Specifies how the cursor position will be calculated * - * @return mixed + * @return void */ public function seek($offset, $whence = SEEK_SET) { - return $this->response->getBody()->seek($offset, $whence); + $this->response->getBody()->seek($offset, $whence); } /** * Seek to the beginning of the stream. * - * @return mixed + * @return void */ public function rewind() { - return $this->response->getBody()->rewind(); + $this->response->getBody()->rewind(); } /** diff --git a/classes/streams/YoutubeStream.php b/classes/streams/YoutubeStream.php index a3e9ac1..3995d11 100644 --- a/classes/streams/YoutubeStream.php +++ b/classes/streams/YoutubeStream.php @@ -6,6 +6,8 @@ namespace Alltube\Stream; +use Alltube\Exception\EmptyUrlException; +use Alltube\Exception\PasswordException; use Alltube\Video; use GuzzleHttp\Psr7\AppendStream; @@ -19,6 +21,8 @@ class YoutubeStream extends AppendStream * YoutubeStream constructor. * * @param Video $video Video to stream + * @throws EmptyUrlException + * @throws PasswordException */ public function __construct(Video $video) { @@ -31,7 +35,7 @@ class YoutubeStream extends AppendStream while ($rangeStart < $contentLenghtHeader[0]) { $rangeEnd = $rangeStart + $video->downloader_options->http_chunk_size; if ($rangeEnd >= $contentLenghtHeader[0]) { - $rangeEnd = $contentLenghtHeader[0] - 1; + $rangeEnd = intval($contentLenghtHeader[0]) - 1; } $response = $video->getHttpResponse(['Range' => 'bytes=' . $rangeStart . '-' . $rangeEnd]); $this->addStream(new YoutubeChunkStream($response)); diff --git a/composer.json b/composer.json index 64d3ec8..0bd4fc6 100644 --- a/composer.json +++ b/composer.json @@ -5,34 +5,35 @@ "homepage": "http://alltubedownload.net/", "type": "project", "require": { - "aura/session": "~2.1.0", - "barracudanetworks/archivestream-php": "~1.0.5", - "guzzlehttp/guzzle": "~6.3.0", + "ext-intl": "*", + "ext-json": "*", + "aura/session": "^2.1", + "barracudanetworks/archivestream-php": "^1.0", + "guzzlehttp/guzzle": "^6.5", "jawira/case-converter": "^3.4", - "mathmarques/smarty-view": "~1.1.0", + "mathmarques/smarty-view": "^1.1", "npm-asset/open-sans-fontface": "^1.4", - "rinvex/countries": "~3.1.0", - "slim/slim": "~3.12.1", + "rinvex/countries": "^6.1", "symfony/process": "^4.0", "symfony/translation": "^4.0", "symfony/yaml": "^4.0", - "zonuexe/http-accept-language": "~0.4.1" + "zonuexe/http-accept-language": "^0.4.1" }, "require-dev": { - "anam/phantomjs-linux-x86-binary": "~2.1.1", + "anam/phantomjs-linux-x86-binary": "^2.1", "consolidation/robo": "^2.0", "ffmpeg/ffmpeg": "^4.1", "heroku/heroku-buildpack-php": "^162.0", "php-mock/php-mock-mockery": "^1.3", - "phpro/grumphp": "^0.17.0", - "phpstan/phpstan": "~0.9.2", + "phpro/grumphp": "^0.18.0", + "phpstan/phpstan": "^0.12.25", "phpunit/phpunit": "^8.4", "roave/security-advisories": "dev-master", "smarty-gettext/smarty-gettext": "^1.6", "squizlabs/php_codesniffer": "^3.5", - "symfony/debug": "^4.0", - "symfony/var-dumper": "^4.0", - "ytdl-org/youtube-dl": "^2020.02" + "symfony/error-handler": "^5.0", + "symfony/var-dumper": "^5.0", + "ytdl-org/youtube-dl": "^2020.05" }, "extra": { "paas": { @@ -50,10 +51,10 @@ "type": "package", "package": { "name": "ytdl-org/youtube-dl", - "version": "2020.02.16", + "version": "2020.05.08", "dist": { "type": "zip", - "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.02.16.zip" + "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.05.08.zip" } } }, diff --git a/composer.lock b/composer.lock index 680a092..15ca205 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bcc40aec18060593e21a8157b07c4f55", + "content-hash": "5fdb499464d2fcf04d97dca8c099a075", "packages": [ { "name": "aura/session", @@ -108,61 +108,31 @@ ], "time": "2018-08-10T13:58:33+00:00" }, - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "abandoned": "psr/container", - "time": "2017-02-14T19:40:03+00:00" - }, { "name": "guzzlehttp/guzzle", - "version": "6.3.3", + "version": "6.5.3", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba" + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", - "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aab4ebd862aa7d04f01a4b51849d657db56d882e", + "reference": "aab4ebd862aa7d04f01a4b51849d657db56d882e", "shasum": "" }, "require": { + "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4", - "php": ">=5.5" + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5", + "symfony/polyfill-intl-idn": "^1.11" }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", - "psr/log": "^1.0" + "psr/log": "^1.1" }, "suggest": { "psr/log": "Required for using the Log middleware" @@ -170,16 +140,16 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.3-dev" + "dev-master": "6.5-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -203,7 +173,7 @@ "rest", "web service" ], - "time": "2018-04-22T15:46:56+00:00" + "time": "2020-04-18T10:38:46+00:00" }, { "name": "guzzlehttp/promises", @@ -501,29 +471,29 @@ }, { "name": "pimple/pimple", - "version": "v3.2.3", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/silexphp/Pimple.git", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/e55d12f9d6a0e7f9c85992b73df1267f46279930", + "reference": "e55d12f9d6a0e7f9c85992b73df1267f46279930", "shasum": "" }, "require": { - "php": ">=5.3.0", + "php": "^7.2.5", "psr/container": "^1.0" }, "require-dev": { - "symfony/phpunit-bridge": "^3.2" + "symfony/phpunit-bridge": "^3.4|^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "3.3.x-dev" } }, "autoload": { @@ -542,12 +512,12 @@ } ], "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", + "homepage": "https://pimple.symfony.com", "keywords": [ "container", "dependency injection" ], - "time": "2018-01-21T07:42:36+00:00" + "time": "2020-03-03T09:12:48+00:00" }, { "name": "psr/container", @@ -690,28 +660,32 @@ }, { "name": "rinvex/countries", - "version": "v3.1.0", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/rinvex/countries.git", - "reference": "e32228ef43f26d3b02296be9454f842c52d492f3" + "reference": "0dd9da817c1faa33429fe56b8ba059fdabe6e0fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rinvex/countries/zipball/e32228ef43f26d3b02296be9454f842c52d492f3", - "reference": "e32228ef43f26d3b02296be9454f842c52d492f3", + "url": "https://api.github.com/repos/rinvex/countries/zipball/0dd9da817c1faa33429fe56b8ba059fdabe6e0fe", + "reference": "0dd9da817c1faa33429fe56b8ba059fdabe6e0fe", "shasum": "" }, "require": { - "php": "^7.0.0" + "php": "^7.2.0" }, "require-dev": { - "phpunit/phpunit": "^5.4.0" + "codedungeon/phpunit-result-printer": "^0.26.0", + "laravel/helpers": "^1.1.0", + "phpunit/phpunit": "^8.3.0" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "3.0-dev" + "laravel": { + "providers": [ + "Rinvex\\Country\\Providers\\CountryServiceProvider" + ] } }, "autoload": { @@ -739,11 +713,11 @@ "role": "Project Lead" }, { - "name": "The Generous Laravel Community", - "homepage": "https://github.com/rinvex/country/contributors" + "name": "The Generous PHP Community", + "homepage": "https://github.com/rinvex/countries/contributors" } ], - "description": "Rinvex Country is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.", + "description": "Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.", "homepage": "https://rinvex.com", "keywords": [ "Flexible", @@ -760,24 +734,26 @@ "rinvex", "svg" ], - "time": "2017-03-07T18:40:20+00:00" + "time": "2020-03-13T18:04:45+00:00" }, { "name": "slim/slim", - "version": "3.12.1", + "version": "3.12.3", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b" + "reference": "1c9318a84ffb890900901136d620b4f03a59da38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/eaee12ef8d0750db62b8c548016d82fb33addb6b", - "reference": "eaee12ef8d0750db62b8c548016d82fb33addb6b", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/1c9318a84ffb890900901136d620b4f03a59da38", + "reference": "1c9318a84ffb890900901136d620b4f03a59da38", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.2", + "ext-json": "*", + "ext-libxml": "*", + "ext-simplexml": "*", "nikic/fast-route": "^1.0", "php": ">=5.5.0", "pimple/pimple": "^3.0", @@ -802,25 +778,25 @@ "MIT" ], "authors": [ - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, { "name": "Josh Lockhart", "email": "hello@joshlockhart.com", "homepage": "https://joshlockhart.com" }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - }, { "name": "Andrew Smith", "email": "a.smith@silentworks.co.uk", "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", @@ -831,7 +807,7 @@ "micro", "router" ], - "time": "2019-04-16T16:47:29+00:00" + "time": "2019-11-28T17:40:33+00:00" }, { "name": "smarty/smarty", @@ -944,6 +920,68 @@ ], "time": "2019-11-27T13:56:44+00:00" }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.17.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-mbstring": "^1.3", + "symfony/polyfill-php72": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.17-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2020-05-12T16:47:27+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.13.0", @@ -1003,6 +1041,61 @@ ], "time": "2019-11-27T14:18:11+00:00" }, + { + "name": "symfony/polyfill-php72", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", + "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, { "name": "symfony/process", "version": "v4.4.0", @@ -1737,6 +1830,38 @@ "description": "Provides a self:update command for Symfony Console applications.", "time": "2018-10-28T01:52:03+00:00" }, + { + "name": "container-interop/container-interop", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "shasum": "" + }, + "require": { + "psr/container": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "homepage": "https://github.com/container-interop/container-interop", + "abandoned": "psr/container", + "time": "2017-02-14T19:40:03+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v1.1.0", @@ -2177,57 +2302,6 @@ ], "time": "2019-09-27T22:17:17+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "1.2", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "reference": "75c7effcf3f77501d0e0caa75111aff4daa0dd48", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.2.0", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A wrapper for ocramius/package-versions to get pretty versions strings", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "time": "2018-06-13T13:22:40+00:00" - }, { "name": "league/container", "version": "2.4.1", @@ -3015,55 +3089,6 @@ ], "time": "2018-02-28T20:30:58+00:00" }, - { - "name": "ocramius/package-versions", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": "~7.0" - }, - "require-dev": { - "composer/composer": "^1.3", - "ext-zip": "*", - "humbug/humbug": "dev-master", - "phpunit/phpunit": "^6.4" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-11-24T11:07:03+00:00" - }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -3486,16 +3511,16 @@ }, { "name": "phpro/grumphp", - "version": "v0.17.0", + "version": "v0.18.0", "source": { "type": "git", "url": "https://github.com/phpro/grumphp.git", - "reference": "4d7b88d8673de8cbba546577f81a7f02deed4d88" + "reference": "b3d80bbcbac8068f21ea5f5da18a4af01d2d471d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpro/grumphp/zipball/4d7b88d8673de8cbba546577f81a7f02deed4d88", - "reference": "4d7b88d8673de8cbba546577f81a7f02deed4d88", + "url": "https://api.github.com/repos/phpro/grumphp/zipball/b3d80bbcbac8068f21ea5f5da18a4af01d2d471d", + "reference": "b3d80bbcbac8068f21ea5f5da18a4af01d2d471d", "shasum": "" }, "require": { @@ -3519,9 +3544,9 @@ "require-dev": { "brianium/paratest": "~3.1", "composer/composer": "~1.9", + "ergebnis/composer-normalize": "~2.1", "friendsofphp/php-cs-fixer": "~2.16", "jakub-onderka/php-parallel-lint": "~1.0", - "localheinz/composer-normalize": "~1.3", "nikic/php-parser": "~3.1", "phpspec/phpspec": "~6.1", "phpunit/phpunit": "^7.5.17", @@ -3536,11 +3561,11 @@ "codegyre/robo": "Lets GrumPHP run your automated PHP tasks.", "designsecurity/progpilot": "Lets GrumPHP be sure that there are no vulnerabilities in your code.", "doctrine/orm": "Lets GrumPHP validate your Doctrine mapping files.", + "ergebnis/composer-normalize": "Lets GrumPHP tidy and normalize your composer.json file.", "friendsofphp/php-cs-fixer": "Lets GrumPHP automatically fix your codestyle.", "friendsoftwig/twigcs": "Lets GrumPHP check Twig coding standard.", "infection/infection": "Lets GrumPHP evaluate the quality your unit tests", "jakub-onderka/php-parallel-lint": "Lets GrumPHP quickly lint your entire code base.", - "localheinz/composer-normalize": "Lets GrumPHP tidy and normalize your composer.json file.", "maglnet/composer-require-checker": "Lets GrumPHP analyze composer dependencies.", "malukenho/kawaii-gherkin": "Lets GrumPHP lint your Gherkin files.", "nikic/php-parser": "Lets GrumPHP run static analyses through your PHP files.", @@ -3587,7 +3612,7 @@ } ], "description": "A composer plugin that enables source code quality checks.", - "time": "2019-11-29T13:17:55+00:00" + "time": "2020-02-25T17:51:17+00:00" }, { "name": "phpspec/prophecy", @@ -3699,66 +3724,45 @@ }, { "name": "phpstan/phpstan", - "version": "0.9.2", + "version": "0.12.25", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488" + "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e59541bcc7cac9b35ca54db6365bf377baf4a488", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64", + "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64", "shasum": "" }, "require": { - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^3.1", - "php": "~7.0", - "phpstan/phpdoc-parser": "^0.2", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" + "php": "^7.1" }, - "require-dev": { - "consistence/coding-standard": "2.2.1", - "ext-gd": "*", - "ext-intl": "*", - "ext-mysqli": "*", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan-php-parser": "^0.9", - "phpstan/phpstan-phpunit": "^0.9.3", - "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.5.4", - "slevomat/coding-standard": "4.0.0" + "conflict": { + "phpstan/phpstan-shim": "*" }, "bin": [ - "bin/phpstan" + "phpstan", + "phpstan.phar" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9-dev" + "dev-master": "0.12-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/", - "build/PHPStan" - ] - } + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2018-01-28T13:22:19+00:00" + "time": "2020-05-10T20:36:16+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4097,16 +4101,16 @@ }, { "name": "psr/log", - "version": "1.1.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -4115,7 +4119,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -4140,7 +4144,7 @@ "psr", "psr-3" ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "roave/security-advisories", @@ -4148,12 +4152,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "9986511fcd47e8b8ec491884cc18beee1773548a" + "reference": "5a342e2dc0408d026b97ee3176b5b406e54e3766" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/9986511fcd47e8b8ec491884cc18beee1773548a", - "reference": "9986511fcd47e8b8ec491884cc18beee1773548a", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5a342e2dc0408d026b97ee3176b5b406e54e3766", + "reference": "5a342e2dc0408d026b97ee3176b5b406e54e3766", "shasum": "" }, "conflict": { @@ -4165,16 +4169,22 @@ "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", "aws/aws-sdk-php": ">=3,<3.2.1", + "bagisto/bagisto": "<0.1.5", + "barrelstrength/sprout-base-email": "<3.9", + "bolt/bolt": "<3.6.10", "brightlocal/phpwhois": "<=4.2.5", + "buddypress/buddypress": "<5.1.2", "bugsnag/bugsnag-laravel": ">=2,<2.0.2", "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7", "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", "cartalyst/sentry": "<=2.1.6", + "centreon/centreon": "<18.10.8|>=19,<19.4.5", + "cesnet/simplesamlphp-module-proxystatistics": "<3.1", "codeigniter/framework": "<=3.0.6", "composer/composer": "<=1-alpha.11", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/core": ">=2,<3.5.39", - "contao/core-bundle": ">=4,<4.4.39|>=4.5,<4.7.5", + "contao/core-bundle": ">=4,<4.4.46|>=4.5,<4.8.6", "contao/listing-bundle": ">=4,<4.4.8", "datadog/dd-trace": ">=0.30,<0.30.2", "david-garcia/phpwhois": "<=4.3.1", @@ -4187,21 +4197,32 @@ "doctrine/mongodb-odm": ">=1,<1.0.2", "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "dolibarr/dolibarr": "<=10.0.6", "dompdf/dompdf": ">=0.6,<0.6.2", - "drupal/core": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1|>8.7.3,<8.7.5", - "drupal/drupal": ">=7,<7.67|>=8,<8.6.16|>=8.7,<8.7.1|>8.7.3,<8.7.5", + "drupal/core": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "drupal/drupal": ">=7,<7.69|>=8,<8.7.12|>=8.8,<8.8.4", + "endroid/qr-code-bundle": "<3.4.2", + "enshrined/svg-sanitize": "<0.13.1", "erusev/parsedown": "<1.7.2", - "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.4", - "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.13.1|>=6,<6.7.9.1|>=6.8,<6.13.5.1|>=7,<7.2.4.1|>=7.3,<7.3.2.1", - "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.12.3|>=2011,<2017.12.4.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3", + "ezsystems/demobundle": ">=5.4,<5.4.6.1", + "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", + "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", + "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", + "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", + "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2", + "ezsystems/ezplatform-user": ">=1,<1.0.1", + "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.1|>=6,<6.7.9.1|>=6.8,<6.13.6.2|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<7.5.6.2", + "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.1|>=2011,<2017.12.7.2|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.4.2", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", "firebase/php-jwt": "<2", "fooman/tcpdf": "<6.2.22", "fossar/tcpdf-parser": "<6.2.22", + "friendsofsymfony/oauth2-php": "<1.3", "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", "fuel/core": "<1.8.1", + "getgrav/grav": "<1.7-beta.8", "gree/jose": "<=2.2", "gregwar/rst": "<1.0.3", "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", @@ -4209,6 +4230,7 @@ "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", "illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29", "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", + "illuminate/view": ">=7,<7.1.2", "ivankristianto/phpwhois": "<=4.3", "james-heinrich/getid3": "<1.9.9", "joomla/session": "<1.3.1", @@ -4216,15 +4238,19 @@ "kazist/phpwhois": "<=4.2.6", "kreait/firebase-php": ">=3.2,<3.8.1", "la-haute-societe/tcpdf": "<6.2.22", - "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30", + "laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30|>=7,<7.1.2", "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", "league/commonmark": "<0.18.3", + "librenms/librenms": "<1.53", + "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", "magento/magento1ce": "<1.9.4.3", "magento/magento1ee": ">=1,<1.14.4.3", - "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2", + "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", "monolog/monolog": ">=1.8,<1.12", "namshi/jose": "<2.2", + "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", "onelogin/php-saml": "<2.10.4", + "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", "openid/php-openid": "<2.3", "oro/crm": ">=1.7,<1.7.4", "oro/platform": ">=1.7,<1.7.4", @@ -4233,48 +4259,67 @@ "paragonie/random_compat": "<2", "paypal/merchant-sdk-php": "<3.12", "pear/archive_tar": "<1.4.4", + "phpfastcache/phpfastcache": ">=5,<5.0.13", "phpmailer/phpmailer": ">=5,<5.2.27|>=6,<6.0.6", - "phpoffice/phpexcel": "<=1.8.1", - "phpoffice/phpspreadsheet": "<=1.5", + "phpmyadmin/phpmyadmin": "<4.9.2", + "phpoffice/phpexcel": "<1.8.2", + "phpoffice/phpspreadsheet": "<1.8", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", + "pimcore/pimcore": "<6.3", + "prestashop/autoupgrade": ">=4,<4.10.1", + "prestashop/gamification": "<2.3.2", + "prestashop/ps_facetedsearch": "<3.4.1", + "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", "propel/propel": ">=2-alpha.1,<=2-alpha.7", "propel/propel1": ">=1,<=1.7.1", "pusher/pusher-php-server": "<2.2.1", - "robrichards/xmlseclibs": ">=1,<3.0.4", + "robrichards/xmlseclibs": "<3.0.4", "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", + "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", "shopware/shopware": "<5.3.7", - "silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11", + "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", + "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", + "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", + "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": ">=3,<3.6.7|>=3.7,<3.7.3|>=4,<4.4", + "silverstripe/framework": "<4.4.5|>=4.5,<4.5.2", "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.1.2", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", + "silverstripe/subsites": ">=2,<2.1.1", + "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", "silverstripe/userforms": "<3", "simple-updates/phpwhois": "<=1", "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", - "simplesamlphp/simplesamlphp": "<1.17.8", + "simplesamlphp/simplesamlphp": "<1.18.6", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", + "simplito/elliptic-php": "<1.0.6", "slim/slim": "<2.6", "smarty/smarty": "<3.1.33", "socalnick/scn-social-auth": "<1.15.2", "spoonity/tcpdf": "<6.2.22", "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", + "ssddanbrown/bookstack": "<0.29.2", "stormpath/sdk": ">=0,<9.9.99", - "studio-42/elfinder": "<2.1.48", + "studio-42/elfinder": "<2.1.49", "swiftmailer/swiftmailer": ">=4,<5.4.5", "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", - "sylius/sylius": ">=1,<1.1.18|>=1.2,<1.2.17|>=1.3,<1.3.12|>=1.4,<1.4.4", + "sylius/resource-bundle": "<1.3.13|>=1.4,<1.4.6|>=1.5,<1.5.1|>=1.6,<1.6.3", + "sylius/sylius": "<1.3.16|>=1.4,<1.4.12|>=1.5,<1.5.9|>=1.6,<1.6.5", + "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", + "symbiote/silverstripe-versionedfiles": "<=2.0.3", "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", - "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", "symfony/mime": ">=4.3,<4.3.8", @@ -4283,14 +4328,14 @@ "symfony/polyfill-php55": ">=1,<1.10", "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", "symfony/routing": ">=2,<2.0.19", - "symfony/security": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", + "symfony/security": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7", "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", - "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/serializer": ">=2,<2.0.11", - "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", + "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", "symfony/translation": ">=2,<2.0.17", "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", @@ -4303,14 +4348,17 @@ "titon/framework": ">=0,<9.9.99", "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", - "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.27|>=9,<9.5.8", - "typo3/cms-core": ">=8,<8.7.27|>=9,<9.5.8", + "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.30|>=9,<9.5.17|>=10,<10.4.2", + "typo3/cms-core": ">=8,<8.7.30|>=9,<9.5.17|>=10,<10.4.2", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", "ua-parser/uap-php": "<3.8", + "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", + "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", "wallabag/tcpdf": "<6.2.22", "willdurand/js-translation-bundle": "<2.1.1", + "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": ">=1.1.14,<1.1.15", "yiisoft/yii2": "<2.0.15", "yiisoft/yii2-bootstrap": "<2.0.4", @@ -4319,6 +4367,7 @@ "yiisoft/yii2-gii": "<2.0.4", "yiisoft/yii2-jui": "<2.0.4", "yiisoft/yii2-redis": "<2.0.8", + "yourls/yourls": "<1.7.4", "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", @@ -4355,10 +4404,15 @@ "name": "Marco Pivetta", "email": "ocramius@gmail.com", "role": "maintainer" + }, + { + "name": "Ilya Tribusean", + "email": "slash3b@gmail.com", + "role": "maintainer" } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2019-11-29T17:22:08+00:00" + "time": "2020-05-12T11:18:47+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -5081,16 +5135,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.2", + "version": "3.5.5", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7" + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", - "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", "shasum": "" }, "require": { @@ -5128,7 +5182,7 @@ "phpcs", "standards" ], - "time": "2019-10-28T04:36:32+00:00" + "time": "2020-04-17T01:09:41+00:00" }, { "name": "symfony/config", @@ -5270,62 +5324,6 @@ "homepage": "https://symfony.com", "time": "2019-11-13T07:39:40+00:00" }, - { - "name": "symfony/debug", - "version": "v4.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "b24b791f817116b29e52a63e8544884cf9a40757" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/b24b791f817116b29e52a63e8544884cf9a40757", - "reference": "b24b791f817116b29e52a63e8544884cf9a40757", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "^3.4|^4.0|^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2019-11-10T17:54:30+00:00" - }, { "name": "symfony/dependency-injection", "version": "v5.0.0", @@ -5399,6 +5397,61 @@ "homepage": "https://symfony.com", "time": "2019-11-21T07:02:40+00:00" }, + { + "name": "symfony/error-handler", + "version": "v5.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "949ffc17c3ac3a9f8e6232220e2da33913c04ea4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/949ffc17c3ac3a9f8e6232220e2da33913c04ea4", + "reference": "949ffc17c3ac3a9f8e6232220e2da33913c04ea4", + "shasum": "" + }, + "require": { + "php": "^7.2.5", + "psr/log": "^1.0", + "symfony/var-dumper": "^4.4|^5.0" + }, + "require-dev": { + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ErrorHandler Component", + "homepage": "https://symfony.com", + "time": "2020-03-30T14:14:32+00:00" + }, { "name": "symfony/event-dispatcher", "version": "v4.4.0", @@ -5680,61 +5733,6 @@ ], "time": "2019-11-18T17:27:11+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.13.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.13-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2019-11-27T13:56:44+00:00" - }, { "name": "symfony/polyfill-php73", "version": "v1.13.0", @@ -5853,32 +5851,31 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.0", + "version": "v5.0.8", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f" + "reference": "09de28632f16f81058a85fcf318397218272a07b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eade2890f8b0eeb279b6cf41b50a10007294490f", - "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/09de28632f16f81058a85fcf318397218272a07b", + "reference": "09de28632f16f81058a85fcf318397218272a07b", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php72": "~1.5" + "php": "^7.2.5", + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", - "symfony/console": "<3.4" + "phpunit/phpunit": "<5.4.3", + "symfony/console": "<4.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^3.4|^4.0|^5.0", + "symfony/console": "^4.4|^5.0", "symfony/process": "^4.4|^5.0", - "twig/twig": "^1.34|^2.4|^3.0" + "twig/twig": "^2.4|^3.0" }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", @@ -5891,7 +5888,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -5925,7 +5922,7 @@ "debug", "dump" ], - "time": "2019-11-12T14:51:11+00:00" + "time": "2020-04-12T16:45:47+00:00" }, { "name": "theseer/tokenizer", @@ -6017,10 +6014,10 @@ }, { "name": "ytdl-org/youtube-dl", - "version": "2020.02.16", + "version": "2020.05.08", "dist": { "type": "zip", - "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.02.16.zip" + "url": "https://github.com/ytdl-org/youtube-dl/archive/2020.05.08.zip" }, "type": "library" } @@ -6032,7 +6029,10 @@ }, "prefer-stable": false, "prefer-lowest": false, - "platform": [], + "platform": { + "ext-intl": "*", + "ext-json": "*" + }, "platform-dev": [], "platform-overrides": { "php": "7.3.11" diff --git a/controllers/DownloadController.php b/controllers/DownloadController.php index 7862b6c..30f1e27 100644 --- a/controllers/DownloadController.php +++ b/controllers/DownloadController.php @@ -66,10 +66,12 @@ class DownloadController extends BaseController /** * Return a converted MP3 file. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response + * @throws PasswordException + * @throws Exception */ private function getConvertedAudioResponse(Request $request, Response $response) { @@ -100,10 +102,11 @@ class DownloadController extends BaseController /** * Return the MP3 file. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response + * @throws PasswordException */ private function getAudioResponse(Request $request, Response $response) { @@ -130,7 +133,7 @@ class DownloadController extends BaseController return $frontController->password($request, $response); } catch (Exception $e) { // If MP3 is not available, we convert it. - $this->video = $this->video->withFormat('bestaudio'); + $this->video = $this->video->withFormat('bestaudio/best'); return $this->getConvertedAudioResponse($request, $response); } @@ -139,10 +142,13 @@ class DownloadController extends BaseController /** * Get a video/audio stream piped through the server. * - * @param Response $response PSR-7 response - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * + * @param Response $response PSR-7 response * @return Response HTTP response + * @throws EmptyUrlException + * @throws PasswordException + * @throws Exception */ private function getStream(Request $request, Response $response) { @@ -205,9 +211,11 @@ class DownloadController extends BaseController * Get a remuxed stream piped through the server. * * @param Response $response PSR-7 response - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * * @return Response HTTP response + * @throws PasswordException + * @throws Exception */ private function getRemuxStream(Request $request, Response $response) { @@ -230,10 +238,13 @@ class DownloadController extends BaseController * Get approriate HTTP response to download query. * Depends on whether we want to stream, remux or simply redirect. * - * @param Response $response PSR-7 response - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * + * @param Response $response PSR-7 response * @return Response HTTP response + * @throws EmptyUrlException + * @throws PasswordException + * @throws Exception */ private function getDownloadResponse(Request $request, Response $response) { @@ -262,10 +273,12 @@ class DownloadController extends BaseController /** * Return a converted video file. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response + * @throws PasswordException + * @throws Exception */ private function getConvertedResponse(Request $request, Response $response) { diff --git a/controllers/FrontController.php b/controllers/FrontController.php index e5e8b47..01030aa 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -9,15 +9,15 @@ namespace Alltube\Controller; use Alltube\Exception\PasswordException; use Alltube\Locale; use Alltube\Video; +use Symfony\Component\ErrorHandler\ErrorHandler; +use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer; +use Symfony\Component\ErrorHandler\Exception\FlattenException; use Throwable; use Exception; use Psr\Container\ContainerInterface; -use Slim\Container; use Slim\Http\Request; use Slim\Http\Response; use Slim\Views\Smarty; -use Symfony\Component\Debug\ExceptionHandler; -use Symfony\Component\Debug\Exception\FlattenException; /** * Main controller. @@ -46,7 +46,7 @@ class FrontController extends BaseController /** * Display index page. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response @@ -58,15 +58,15 @@ class FrontController extends BaseController $response, 'index.tpl', [ - 'config' => $this->config, - 'class' => 'index', - 'description' => $this->localeManager->t( + 'config' => $this->config, + 'class' => 'index', + 'description' => $this->localeManager->t( 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.' ), - 'domain' => $uri->getScheme() . '://' . $uri->getAuthority(), - 'canonical' => $this->getCanonicalUrl($request), + 'domain' => $uri->getScheme() . '://' . $uri->getAuthority(), + 'canonical' => $this->getCanonicalUrl($request), 'supportedLocales' => $this->localeManager->getSupportedLocales(), - 'locale' => $this->localeManager->getLocale(), + 'locale' => $this->localeManager->getLocale(), ] ); @@ -76,9 +76,9 @@ class FrontController extends BaseController /** * Switch locale. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response - * @param array $data Query parameters + * @param string[] $data Query parameters * * @return Response */ @@ -92,10 +92,11 @@ class FrontController extends BaseController /** * Display a list of extractors. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response + * @throws PasswordException */ public function extractors(Request $request, Response $response) { @@ -103,14 +104,14 @@ class FrontController extends BaseController $response, 'extractors.tpl', [ - 'config' => $this->config, - 'extractors' => Video::getExtractors(), - 'class' => 'extractors', - 'title' => $this->localeManager->t('Supported websites'), + 'config' => $this->config, + 'extractors' => Video::getExtractors(), + 'class' => 'extractors', + 'title' => $this->localeManager->t('Supported websites'), 'description' => $this->localeManager->t('List of all supported websites from which Alltube Download ' . 'can extract video or audio files'), 'canonical' => $this->getCanonicalUrl($request), - 'locale' => $this->localeManager->getLocale(), + 'locale' => $this->localeManager->getLocale(), ] ); @@ -120,7 +121,7 @@ class FrontController extends BaseController /** * Display a password prompt. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response @@ -131,14 +132,14 @@ class FrontController extends BaseController $response, 'password.tpl', [ - 'config' => $this->config, - 'class' => 'password', - 'title' => $this->localeManager->t('Password prompt'), + 'config' => $this->config, + 'class' => 'password', + 'title' => $this->localeManager->t('Password prompt'), 'description' => $this->localeManager->t( 'You need a password in order to download this video with Alltube Download' ), - 'canonical' => $this->getCanonicalUrl($request), - 'locale' => $this->localeManager->getLocale(), + 'canonical' => $this->getCanonicalUrl($request), + 'locale' => $this->localeManager->getLocale(), ] ); @@ -148,7 +149,7 @@ class FrontController extends BaseController /** * Return the video description page. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response @@ -185,13 +186,13 @@ class FrontController extends BaseController $response, $template, [ - 'video' => $this->video, - 'class' => 'info', - 'title' => $title, - 'description' => $description, - 'config' => $this->config, - 'canonical' => $this->getCanonicalUrl($request), - 'locale' => $this->localeManager->getLocale(), + 'video' => $this->video, + 'class' => 'info', + 'title' => $title, + 'description' => $description, + 'config' => $this->config, + 'canonical' => $this->getCanonicalUrl($request), + 'locale' => $this->localeManager->getLocale(), 'defaultFormat' => $this->defaultFormat, ] ); @@ -202,7 +203,7 @@ class FrontController extends BaseController /** * Dislay information about the video. * - * @param Request $request PSR-7 request + * @param Request $request PSR-7 request * @param Response $response PSR-7 response * * @return Response HTTP response @@ -231,18 +232,18 @@ class FrontController extends BaseController /** * Display an error page. * - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * @param Throwable $error Error to display + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param Throwable $error Error to display * * @return Response HTTP response */ public function error(Request $request, Response $response, Throwable $error) { if ($this->config->debug) { - $exception = FlattenException::createFromThrowable($error); - $handler = new ExceptionHandler(); - $response->getBody()->write($handler->getHtml($exception)); + $renderer = new HtmlErrorRenderer(true); + $exception = $renderer->render($error); + $response->getBody()->write($exception->getAsString()); return $response->withStatus($exception->getStatusCode()); } else { @@ -256,12 +257,12 @@ class FrontController extends BaseController $response, 'error.tpl', [ - 'config' => $this->config, - 'error' => $message, - 'class' => 'video', - 'title' => $this->localeManager->t('Error'), + 'config' => $this->config, + 'error' => $message, + 'class' => 'video', + 'title' => $this->localeManager->t('Error'), 'canonical' => $this->getCanonicalUrl($request), - 'locale' => $this->localeManager->getLocale(), + 'locale' => $this->localeManager->getLocale(), ] ); diff --git a/grumphp.yml b/grumphp.yml index 466e31a..8454537 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -1,17 +1,16 @@ --- parameters: - ascii: ~ - tasks: - jsonlint: ~ - xmllint: ~ - yamllint: ~ - composer: ~ - phpcs: - standard: PSR12 - ignore_patterns: - - RoboFile.php - phpstan: - level: max - configuration: phpstan.neon - ignore_patterns: - - RoboFile.php + ascii: ~ + tasks: + jsonlint: ~ + xmllint: ~ + yamllint: ~ + composer: ~ + phpcs: + standard: PSR12 + ignore_patterns: + - RoboFile.php + phpstan: + level: max + ignore_patterns: + - RoboFile.php diff --git a/index.php b/index.php index 6dd0a45..a8b3aed 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,7 @@ getMessage()); + } } // Create app. $app = new App(); + +/** @var Container $container */ $container = $app->getContainer(); // Load config. @@ -47,7 +55,11 @@ $container['locale'] = LocaleManager::getInstance(); $app->add(new LocaleMiddleware($container)); // Smarty. -$container['view'] = ViewFactory::create($container); +try { + $container['view'] = ViewFactory::create($container); +} catch (SmartyException $e) { + die('Could not load Smarty: ' . $e->getMessage()); +} // Controllers. $frontController = new FrontController($container); @@ -102,4 +114,7 @@ try { $app->run(); } catch (SmartyException $e) { die('Smarty could not compile the template file: ' . $e->getMessage()); +} catch (Throwable $e) { + // Last resort if the error has not been caught by the error handler for some reason. + die('Error when starting the app: ' . $e->getMessage()); } diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 5b7e4e6..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - ignoreErrors: - # The Archive constructor messes up the output buffering. - - '#Alltube\\Stream\\PlaylistArchiveStream::__construct\(\) does not call parent constructor from Barracuda\\ArchiveStream\\ZipArchive\.#' diff --git a/phpunit.xml b/phpunit.xml index 146eaba..dfdb3ad 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,18 +1,18 @@ - - - classes/ - controllers/ - - - - - tests/ - - - - - - + + + classes/ + controllers/ + + + + + tests/ + + + + + + diff --git a/resources/error.xhtml b/resources/error.xhtml index b62b34f..c0f95bf 100644 --- a/resources/error.xhtml +++ b/resources/error.xhtml @@ -1,21 +1,23 @@ - + - + AllTube Download - Maintenance - - -
-
+ + +
+

- +

-
An error occurred in the application and your page could not be served. Please try again in a few moments.
-
+
An error occurred in the application and your page could not be served. Please try again in a few + moments. +
- +
+ diff --git a/resources/maintenance.xhtml b/resources/maintenance.xhtml index f84d871..c1c9eba 100644 --- a/resources/maintenance.xhtml +++ b/resources/maintenance.xhtml @@ -1,21 +1,21 @@ - + - + AllTube Download - Maintenance - - -
-
+ + +
+

- +

This application is undergoing maintenance right now. Please check back later.
-
- +
+ diff --git a/resources/sitemap.xml b/resources/sitemap.xml index cb423ae..f6331f0 100644 --- a/resources/sitemap.xml +++ b/resources/sitemap.xml @@ -1,12 +1,12 @@ - - https://alltubedownload.net/ - yearly - 1 - - - https://alltubedownload.net/extractors - weekly - + + https://alltubedownload.net/ + yearly + 1 + + + https://alltubedownload.net/extractors + weekly + diff --git a/templates/error.tpl b/templates/error.tpl index 55adeb5..49663ec 100644 --- a/templates/error.tpl +++ b/templates/error.tpl @@ -6,4 +6,4 @@ {t}Please check the URL of your video.{/t}

{$error|escape}

-{include file='inc/footer.tpl'} + {include file='inc/footer.tpl'} diff --git a/templates/extractors.tpl b/templates/extractors.tpl index fb85994..a1d1bce 100644 --- a/templates/extractors.tpl +++ b/templates/extractors.tpl @@ -3,10 +3,10 @@ {include file='inc/logo.tpl'}

{t}Supported websites{/t}

-
    - {foreach $extractors as $extractor} -
  • {$extractor}
  • - {/foreach} -
+
    + {foreach $extractors as $extractor} +
  • {$extractor}
  • + {/foreach} +
{include file='inc/footer.tpl'} diff --git a/templates/inc/footer.tpl b/templates/inc/footer.tpl index 2a889ca..dbf7c74 100644 --- a/templates/inc/footer.tpl +++ b/templates/inc/footer.tpl @@ -31,7 +31,7 @@ · + href="https://liberapay.com/Rudloff/donate"> {t}Donate{/t}
diff --git a/templates/inc/head.tpl b/templates/inc/head.tpl index 43f0f62..00a98c8 100644 --- a/templates/inc/head.tpl +++ b/templates/inc/head.tpl @@ -1,25 +1,25 @@ - + {if isset($description)} - - - + + + {/if} - - + + {$config->appName}{if isset($title)} - {$title|escape}{/if} - - - - - - - - + + + + + + + + - + diff --git a/templates/inc/header.tpl b/templates/inc/header.tpl index 8a9c569..3e8f233 100644 --- a/templates/inc/header.tpl +++ b/templates/inc/header.tpl @@ -13,8 +13,8 @@ {if $supportedLocale != $locale}
  • + lang="{$supportedLocale->getBcp47()}" + href="{path_for name='locale' data=['locale'=>$supportedLocale->getIso15897()]}"> {if $supportedLocale->getCountry()} {$supportedLocale->getCountry()->getEmoji()} {/if} diff --git a/templates/inc/logo.tpl b/templates/inc/logo.tpl index 0b3dade..b1da44f 100644 --- a/templates/inc/logo.tpl +++ b/templates/inc/logo.tpl @@ -1,4 +1,5 @@

    - -{$config->appName} -

    + + {$config->appName} + diff --git a/templates/index.tpl b/templates/index.tpl index 707c45d..21e11d4 100644 --- a/templates/index.tpl +++ b/templates/index.tpl @@ -2,41 +2,45 @@ {include file='inc/header.tpl'}
    + alt="{$config->appName}" width="328" height="284">
  • - -
    + +
    + required placeholder="http://example.com/video"/> - {if $config->uglyUrls} - - {/if} -
    - {if $config->convert} -
    -
    - - -
    - - + {if $config->uglyUrls} + + {/if} +
    + {if $config->convert} +
    +
    + + +
    + + +
    -
    - {/if} -
    + {/if} +
    {t}See all supported websites{/t}

    {t}Drag this to your bookmarks bar:{/t}

    - {t}Bookmarklet{/t} + {t}Bookmarklet{/t}
    diff --git a/templates/info.tpl b/templates/info.tpl index 0a3435d..07ae547 100644 --- a/templates/info.tpl +++ b/templates/info.tpl @@ -1,100 +1,105 @@ {include file="inc/head.tpl"}
    -
    -
    -{include file="inc/logo.tpl"} -{$title=" +
    +
    + {include file="inc/logo.tpl"} + {$title=" "} -

    - {t params=['@title' => $title]}You are going to download @title.{/t} -

    -{if isset($video->thumbnail)} - -{/if} -{if isset($video->description)} - -{/if} -{if isset($video->upload_date)} - -{/if} -
    -
    - - {if $config->uglyUrls} - - {/if} - {if isset($video->formats) && count($video->formats) > 1} -

    -

    - {/if} - {if $config->stream} - stream != 'ask'}checked{/if} name="stream" id="stream"/> - -

    - {/if} - {if $config->convertAdvanced} - - - - {t}with{/t} - - - {t}kbit/s audio{/t} -

    - {/if} -
    -
    -
    -
    -{include file="inc/footer.tpl"} +

    + {t params=['@title' => $title]}You are going to download @title.{/t} +

    + {if isset($video->thumbnail)} + + {/if} + {if isset($video->description)} + + {/if} + {if isset($video->upload_date)} + + {/if} +
    +
    + + {if $config->uglyUrls} + + {/if} + {if isset($video->formats) && count($video->formats) > 1} +

    + +
    +
    + {/if} + {if $config->stream} + stream != 'ask'}checked{/if} name="stream" id="stream"/> + +
    +
    + {/if} + {if $config->convertAdvanced} + + + + {t}with{/t} + + + {t}kbit/s audio{/t} +
    +
    + {/if} +
    +
    +
    +
    + {include file="inc/footer.tpl"} diff --git a/templates/password.tpl b/templates/password.tpl index 3425f36..62c0f4c 100644 --- a/templates/password.tpl +++ b/templates/password.tpl @@ -6,9 +6,9 @@

    {t}You need a password in order to download this video.{/t}

    - +

    - +
    -{include file='inc/footer.tpl'} + {include file='inc/footer.tpl'} diff --git a/templates/playlist.tpl b/templates/playlist.tpl index 5804e4b..179a394 100644 --- a/templates/playlist.tpl +++ b/templates/playlist.tpl @@ -1,43 +1,44 @@ {include file="inc/head.tpl"}
    -
    -{include file="inc/logo.tpl"} +
    + {include file="inc/logo.tpl"} -{if isset($video->title)} - {$title=" + {if isset($video->title)} + {$title=" {$video->title} "} -

    - {t params=['@title'=>$title]}Videos extracted from @title:{/t} -

    -{/if} +

    + {t params=['@title'=>$title]}Videos extracted from @title:{/t} +

    + {/if} -{if $config->stream} - webpage_url}" class="downloadBtn">Download everything -{/if} -{foreach $video->entries as $entry} -
    -

    webpage_url}" class="downloadBtn">Download everything + {/if} + {foreach $video->entries as $entry} +
    +

    - {if !isset($entry->title)} - {if $entry->ie_key == YoutubePlaylist} - Playlist - {else} - Video - {/if} - {else} - {$entry->title} - {/if} -

    - url}">{t}Download{/t} - url}">{t}More options{/t} -
    -{/foreach} + {if !isset($entry->title)} + {if $entry->ie_key == YoutubePlaylist} + Playlist + {else} + Video + {/if} + {else} + {$entry->title} + {/if} +

    + url}">{t}Download{/t} + url}">{t}More options{/t} +
    + {/foreach} -
    -{include file="inc/footer.tpl"} +
    + {include file="inc/footer.tpl"} diff --git a/tests/BaseTest.php b/tests/BaseTest.php index b0d1a48..d717b79 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -7,6 +7,7 @@ namespace Alltube\Test; use Alltube\Config; +use Exception; use PHPUnit\Framework\TestCase; /** @@ -32,6 +33,7 @@ abstract class BaseTest extends TestCase /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index bacdc3a..09374cf 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -23,6 +23,7 @@ class ConfigTest extends BaseTest /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { @@ -39,7 +40,7 @@ class ConfigTest extends BaseTest public function testGetInstance() { $config = Config::getInstance(); - $this->assertEquals($config->convert, false); + $this->assertEquals(false, $config->convert); $this->assertConfig($config); } @@ -53,7 +54,7 @@ class ConfigTest extends BaseTest Config::destroyInstance(); $config = Config::getInstance(); - $this->assertEquals($config->convert, false); + $this->assertEquals(false, $config->convert); $this->assertConfig($config); } @@ -81,6 +82,7 @@ class ConfigTest extends BaseTest * Test the setFile function. * * @return void + * @throws Exception */ public function testSetFile() { @@ -103,24 +105,26 @@ class ConfigTest extends BaseTest * Test the setOptions function. * * @return void + * @throws Exception */ public function testSetOptions() { Config::setOptions(['appName' => 'foo']); $config = Config::getInstance(); - $this->assertEquals($config->appName, 'foo'); + $this->assertEquals('foo', $config->appName); } /** * Test the setOptions function. * * @return void + * @throws Exception */ public function testSetOptionsWithoutUpdate() { Config::setOptions(['appName' => 'foo'], false); $config = Config::getInstance(); - $this->assertEquals($config->appName, 'foo'); + $this->assertEquals('foo', $config->appName); } /** @@ -149,6 +153,7 @@ class ConfigTest extends BaseTest * Test the getInstance function with the CONVERT and PYTHON environment variables. * * @return void + * @throws Exception */ public function testGetInstanceWithEnv() { @@ -156,7 +161,7 @@ class ConfigTest extends BaseTest putenv('CONVERT=1'); Config::setFile($this->getConfigFile()); $config = Config::getInstance(); - $this->assertEquals($config->convert, true); + $this->assertEquals(true, $config->convert); putenv('CONVERT'); } } diff --git a/tests/ControllerTest.php b/tests/ControllerTest.php index 7d90efe..bd9f737 100644 --- a/tests/ControllerTest.php +++ b/tests/ControllerTest.php @@ -6,10 +6,12 @@ namespace Alltube\Test; +use Alltube\Controller\BaseController; use Alltube\Controller\DownloadController; use Alltube\Controller\FrontController; use Alltube\LocaleManager; use Alltube\ViewFactory; +use Exception; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -43,11 +45,13 @@ abstract class ControllerTest extends BaseTest /** * Controller instance used in tests. + * @var BaseController */ protected $controller; /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { @@ -78,7 +82,7 @@ abstract class ControllerTest extends BaseTest * Run controller function with custom query parameters and return the result. * * @param string $request Controller function to call - * @param array $params Query parameters + * @param mixed[] $params Query parameters * * @return Response HTTP response */ @@ -94,7 +98,7 @@ abstract class ControllerTest extends BaseTest * Assert that calling controller function with these parameters returns a 200 HTTP response. * * @param string $request Controller function to call - * @param array $params Query parameters + * @param mixed[] $params Query parameters * * @return void */ @@ -107,7 +111,7 @@ abstract class ControllerTest extends BaseTest * Assert that calling controller function with these parameters returns an HTTP redirect. * * @param string $request Controller function to call - * @param array $params Query parameters + * @param mixed[] $params Query parameters * * @return void */ @@ -120,7 +124,7 @@ abstract class ControllerTest extends BaseTest * Assert that calling controller function with these parameters returns an HTTP 500 error. * * @param string $request Controller function to call - * @param array $params Query parameters + * @param mixed[] $params Query parameters * * @return void */ @@ -133,7 +137,7 @@ abstract class ControllerTest extends BaseTest * Assert that calling controller function with these parameters returns an HTTP 400 error. * * @param string $request Controller function to call - * @param array $params Query parameters + * @param mixed[] $params Query parameters * * @return void */ diff --git a/tests/ConvertedPlaylistArchiveStreamTest.php b/tests/ConvertedPlaylistArchiveStreamTest.php index 57c7fe6..e8cb002 100644 --- a/tests/ConvertedPlaylistArchiveStreamTest.php +++ b/tests/ConvertedPlaylistArchiveStreamTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Stream\ConvertedPlaylistArchiveStream; use Alltube\Video; +use Exception; /** * Unit tests for the ConvertedPlaylistArchiveStream class. @@ -17,6 +18,7 @@ class ConvertedPlaylistArchiveStreamTest extends StreamTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/DownloadControllerTest.php b/tests/DownloadControllerTest.php index 9e93c98..761ba21 100644 --- a/tests/DownloadControllerTest.php +++ b/tests/DownloadControllerTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Config; use Alltube\Controller\DownloadController; +use Exception; /** * Unit tests for the FrontController class. @@ -17,6 +18,7 @@ class DownloadControllerTest extends ControllerTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { @@ -62,6 +64,7 @@ class DownloadControllerTest extends ControllerTest * Test the download() function with streams enabled. * * @return void + * @throws Exception */ public function testDownloadWithStream() { @@ -77,6 +80,7 @@ class DownloadControllerTest extends ControllerTest * Test the download() function with an M3U stream. * * @return void + * @throws Exception */ public function testDownloadWithM3uStream() { @@ -96,6 +100,7 @@ class DownloadControllerTest extends ControllerTest * Test the download() function with an RTMP stream. * * @return void + * @throws Exception */ public function testDownloadWithRtmpStream() { @@ -113,6 +118,7 @@ class DownloadControllerTest extends ControllerTest * Test the download() function with a remuxed video. * * @return void + * @throws Exception */ public function testDownloadWithRemux() { @@ -182,6 +188,7 @@ class DownloadControllerTest extends ControllerTest * * @return void * @requires OS Linux + * @throws Exception */ public function testDownloadWithPlaylist() { @@ -197,6 +204,7 @@ class DownloadControllerTest extends ControllerTest * Test the download() function with an advanced conversion. * * @return void + * @throws Exception */ public function testDownloadWithAdvancedConversion() { diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index 20b34bf..92e4824 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -17,8 +17,15 @@ use Slim\Http\Request; */ class FrontControllerTest extends ControllerTest { + /** + * Controller instance used in tests. + * @var FrontController + */ + protected $controller; + /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { @@ -41,6 +48,7 @@ class FrontControllerTest extends ControllerTest * Test the constructor with streams enabled. * * @return void + * @throws Exception */ public function testConstructorWithStream() { @@ -120,6 +128,7 @@ class FrontControllerTest extends ControllerTest * * @return void * @requires download + * @throws Exception */ public function testInfoWithAudio() { @@ -136,6 +145,7 @@ class FrontControllerTest extends ControllerTest * * @return void * @requires download + * @throws Exception */ public function testInfoWithVimeoAudio() { @@ -150,6 +160,7 @@ class FrontControllerTest extends ControllerTest * * @return void * @requires download + * @throws Exception */ public function testInfoWithUnconvertedAudio() { @@ -197,6 +208,7 @@ class FrontControllerTest extends ControllerTest * * @return void * @requires download + * @throws Exception */ public function testInfoWithStream() { diff --git a/tests/JsonControllerTest.php b/tests/JsonControllerTest.php index 9256c38..d2d6c3e 100644 --- a/tests/JsonControllerTest.php +++ b/tests/JsonControllerTest.php @@ -7,6 +7,7 @@ namespace Alltube\Test; use Alltube\Controller\JsonController; +use Exception; /** * Unit tests for the FrontController class. @@ -15,6 +16,7 @@ class JsonControllerTest extends ControllerTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/LocaleMiddlewareTest.php b/tests/LocaleMiddlewareTest.php index d751bd9..feb05c2 100644 --- a/tests/LocaleMiddlewareTest.php +++ b/tests/LocaleMiddlewareTest.php @@ -6,7 +6,6 @@ namespace Alltube\Test; -use Alltube\Locale; use Alltube\LocaleManager; use Alltube\LocaleMiddleware; use Slim\Container; diff --git a/tests/PlaylistArchiveStreamTest.php b/tests/PlaylistArchiveStreamTest.php index 09848e3..f02a6ea 100644 --- a/tests/PlaylistArchiveStreamTest.php +++ b/tests/PlaylistArchiveStreamTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Stream\PlaylistArchiveStream; use Alltube\Video; +use Exception; /** * Unit tests for the PlaylistArchiveStream class. @@ -17,6 +18,7 @@ class PlaylistArchiveStreamTest extends StreamTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/StreamTest.php b/tests/StreamTest.php index 7ffe235..f634838 100644 --- a/tests/StreamTest.php +++ b/tests/StreamTest.php @@ -6,6 +6,7 @@ namespace Alltube\Test; +use Psr\Http\Message\StreamInterface; use RuntimeException; /** @@ -15,6 +16,7 @@ abstract class StreamTest extends BaseTest { /** * Stream instance. + * @var StreamInterface */ protected $stream; @@ -36,7 +38,7 @@ abstract class StreamTest extends BaseTest public function testWrite() { if ($this->stream->isWritable()) { - $this->assertNull($this->stream->write('foo')); + $this->assertIsInt($this->stream->write('foo')); } else { $this->expectException(RuntimeException::class); $this->stream->write('foo'); @@ -103,7 +105,7 @@ abstract class StreamTest extends BaseTest */ public function testEof() { - $this->assertFalse($this->stream->eof()); + $this->assertIsBool($this->stream->eof()); } /** diff --git a/tests/VideoStubsTest.php b/tests/VideoStubsTest.php index 755cdb2..51f758d 100644 --- a/tests/VideoStubsTest.php +++ b/tests/VideoStubsTest.php @@ -26,6 +26,7 @@ class VideoStubsTest extends BaseTest /** * Initialize properties used by test. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/VideoTest.php b/tests/VideoTest.php index 7967f47..e6d4552 100644 --- a/tests/VideoTest.php +++ b/tests/VideoTest.php @@ -7,6 +7,8 @@ namespace Alltube\Test; use Alltube\Config; +use Alltube\Exception\EmptyUrlException; +use Alltube\Exception\PasswordException; use Alltube\Video; use Exception; @@ -20,6 +22,7 @@ class VideoTest extends BaseTest * Test getExtractors function. * * @return void + * @throws PasswordException */ public function testGetExtractors() { @@ -29,13 +32,15 @@ class VideoTest extends BaseTest /** * Test getUrl function. * - * @param string $url URL - * @param string $format Format - * @param string $filename Filename + * @param string $url URL + * @param string $format Format + * @param string $filename Filename * @param string $extension File extension - * @param string $domain Domain + * @param string $domain Domain * * @return void + * @throws PasswordException + * @throws EmptyUrlException * @dataProvider urlProvider * @dataProvider m3uUrlProvider * @dataProvider remuxUrlProvider @@ -57,6 +62,8 @@ class VideoTest extends BaseTest * Test getUrl function with a protected video. * * @return void + * @throws EmptyUrlException + * @throws PasswordException */ public function testgetUrlWithPassword() { @@ -70,6 +77,8 @@ class VideoTest extends BaseTest * Test getUrl function with a protected video and no password. * * @return void + * @throws EmptyUrlException + * @throws PasswordException */ public function testgetUrlWithMissingPassword() { @@ -82,6 +91,8 @@ class VideoTest extends BaseTest * Test getUrl function with a protected video and a wrong password. * * @return void + * @throws EmptyUrlException + * @throws PasswordException */ public function testgetUrlWithWrongPassword() { @@ -96,6 +107,8 @@ class VideoTest extends BaseTest * @param string $url URL * * @return void + * @throws EmptyUrlException + * @throws PasswordException * @dataProvider ErrorUrlProvider */ public function testgetUrlError($url) @@ -112,7 +125,7 @@ class VideoTest extends BaseTest */ public function urlProvider() { - $videos = [ + return [ [ 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'best[protocol^=http]', 'It_s_Not_Me_It_s_You_-_Hearts_Under_Fire-M7IpKCZ47pU', @@ -136,11 +149,9 @@ class VideoTest extends BaseTest 'https://vimeo.com/24195442', 'http-720p', 'Carving_the_Mountains-24195442', 'mp4', - 'gcs-vimeo.akamaized.net', + 'akamaized.net', ] ]; - - return $videos; } /** @@ -167,7 +178,7 @@ class VideoTest extends BaseTest */ public function m3uUrlProvider() { - $videos = [ + return [ [ 'https://twitter.com/verge/status/813055465324056576/video/1', 'hls-2176', 'The_Verge_-_This_tiny_origami_robot_can_self-fold_and_complete_tasks-813055465324056576', @@ -175,8 +186,6 @@ class VideoTest extends BaseTest 'video.twimg.com', ] ]; - - return $videos; } /** @@ -211,12 +220,13 @@ class VideoTest extends BaseTest /** * Test getJSON function. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider urlProvider * @dataProvider m3uUrlProvider + * @throws PasswordException */ public function testGetJson($url, $format) { @@ -237,6 +247,7 @@ class VideoTest extends BaseTest * * @return void * @dataProvider ErrorURLProvider + * @throws PasswordException */ public function testGetJsonError($url) { @@ -248,15 +259,16 @@ class VideoTest extends BaseTest /** * Test getFilename function. * - * @param string $url URL - * @param string $format Format - * @param string $filename Filename + * @param string $url URL + * @param string $format Format + * @param string $filename Filename * @param string $extension File extension * * @return void * @dataProvider urlProvider * @dataProvider m3uUrlProvider * @dataProvider remuxUrlProvider + * @throws PasswordException */ public function testGetFilename($url, $format, $filename, $extension) { @@ -271,6 +283,7 @@ class VideoTest extends BaseTest * * @return void * @dataProvider ErrorUrlProvider + * @throws PasswordException */ public function testGetFilenameError($url) { @@ -282,11 +295,12 @@ class VideoTest extends BaseTest /** * Test getAudioStream function. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider urlProvider + * @throws Exception */ public function testGetAudioStream($url, $format) { @@ -371,11 +385,12 @@ class VideoTest extends BaseTest /** * Test getM3uStream function. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider m3uUrlProvider + * @throws Exception */ public function testGetM3uStream($url, $format) { @@ -386,11 +401,12 @@ class VideoTest extends BaseTest /** * Test getRemuxStream function. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider remuxUrlProvider + * @throws Exception */ public function testGetRemuxStream($url, $format) { @@ -417,11 +433,12 @@ class VideoTest extends BaseTest /** * Test getRtmpStream function. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider rtmpUrlProvider + * @throws Exception */ public function testGetRtmpStream($url, $format) { @@ -453,11 +470,12 @@ class VideoTest extends BaseTest /** * Test getConvertedStream function without avconv. * - * @param string $url URL + * @param string $url URL * @param string $format Format * * @return void * @dataProvider urlProvider + * @throws Exception */ public function testGetConvertedStream($url, $format) { diff --git a/tests/ViewFactoryTest.php b/tests/ViewFactoryTest.php index 45286c9..1bafff9 100644 --- a/tests/ViewFactoryTest.php +++ b/tests/ViewFactoryTest.php @@ -12,6 +12,7 @@ use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; use Slim\Views\Smarty; +use SmartyException; /** * Unit tests for the ViewFactory class. @@ -22,6 +23,7 @@ class ViewFactoryTest extends BaseTest * Test the create() function. * * @return void + * @throws SmartyException */ public function testCreate() { @@ -35,6 +37,7 @@ class ViewFactoryTest extends BaseTest * Test the create() function with a X-Forwarded-Proto header. * * @return void + * @throws SmartyException */ public function testCreateWithXForwardedProto() { diff --git a/tests/YoutubeChunkStreamTest.php b/tests/YoutubeChunkStreamTest.php index 5cce098..41a2f38 100644 --- a/tests/YoutubeChunkStreamTest.php +++ b/tests/YoutubeChunkStreamTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Stream\YoutubeChunkStream; use Alltube\Video; +use Exception; /** * Unit tests for the YoutubeChunkStream class. @@ -17,6 +18,7 @@ class YoutubeChunkStreamTest extends StreamTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/YoutubeStreamTest.php b/tests/YoutubeStreamTest.php index 2345ea9..b8b4d13 100644 --- a/tests/YoutubeStreamTest.php +++ b/tests/YoutubeStreamTest.php @@ -8,6 +8,7 @@ namespace Alltube\Test; use Alltube\Stream\YoutubeStream; use Alltube\Video; +use Exception; /** * Unit tests for the YoutubeStream class. @@ -17,6 +18,7 @@ class YoutubeStreamTest extends StreamTest { /** * Prepare tests. + * @throws Exception */ protected function setUp(): void { diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 72eed31..43b3b3d 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,7 +9,7 @@ use phpmock\mockery\PHPMockery; // Composer autoload. require_once __DIR__ . '/../vendor/autoload.php'; -ini_set('session.use_cookies', 0); +ini_set('session.use_cookies', '0'); session_cache_limiter(''); session_start();