From f670629d49906f3238f7f5ff4515186bc783bc5f Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Thu, 17 Dec 2020 22:45:50 +0100 Subject: [PATCH] Add return types --- classes/Downloader.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/Downloader.php b/classes/Downloader.php index ee810eb..2b0b4f9 100644 --- a/classes/Downloader.php +++ b/classes/Downloader.php @@ -115,7 +115,7 @@ class Downloader * @param string|null $password Password * @return Video */ - public function getVideo(string $webpageUrl, $requestedFormat = 'best/bestvideo', string $password = null) + public function getVideo(string $webpageUrl, $requestedFormat = 'best/bestvideo', string $password = null): Video { return new Video($this, $webpageUrl, $requestedFormat, $password); } @@ -127,7 +127,7 @@ class Downloader * * @return Process */ - private function getProcess(array $arguments) + private function getProcess(array $arguments): Process { return new Process( array_merge( @@ -145,7 +145,7 @@ class Downloader * * @return bool False if the command returns an error, true otherwise */ - public static function checkCommand(array $command) + public static function checkCommand(array $command): bool { $process = new Process($command); $process->run(); @@ -178,7 +178,7 @@ class Downloader $audioOnly = true, string $from = null, string $to = null - ) { + ): Process { if (!$this->checkCommand([$this->avconv, '-version'])) { throw new AvconvException($this->avconv); } @@ -246,7 +246,7 @@ class Downloader * @throws YoutubedlException If youtube-dl returns an error * @throws PasswordException If the video is protected by a password and no password was specified */ - public function callYoutubedl(array $arguments) + public function callYoutubedl(array $arguments): string { $process = $this->getProcess($arguments); //This is needed by the openload extractor because it runs PhantomJS @@ -468,7 +468,7 @@ class Downloader * * @throws AlltubeLibraryException */ - public function getExtractors() + public function getExtractors(): array { return explode("\n", trim($this->callYoutubedl(['--list-extractors']))); } @@ -484,7 +484,7 @@ class Downloader * @throws AlltubeLibraryException * @link https://github.com/guzzle/guzzle/issues/2640 */ - public function getHttpResponse(Video $video, array $headers = []) + public function getHttpResponse(Video $video, array $headers = []): ResponseInterface { // IDN conversion breaks with Google hosts like https://r3---sn-25glene6.googlevideo.com/. $client = new Client(['idn_conversion' => false]);