Add return types
This commit is contained in:
parent
ec18e416a2
commit
f670629d49
1 changed files with 7 additions and 7 deletions
|
@ -115,7 +115,7 @@ class Downloader
|
||||||
* @param string|null $password Password
|
* @param string|null $password Password
|
||||||
* @return Video
|
* @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);
|
return new Video($this, $webpageUrl, $requestedFormat, $password);
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class Downloader
|
||||||
*
|
*
|
||||||
* @return Process<string>
|
* @return Process<string>
|
||||||
*/
|
*/
|
||||||
private function getProcess(array $arguments)
|
private function getProcess(array $arguments): Process
|
||||||
{
|
{
|
||||||
return new Process(
|
return new Process(
|
||||||
array_merge(
|
array_merge(
|
||||||
|
@ -145,7 +145,7 @@ class Downloader
|
||||||
*
|
*
|
||||||
* @return bool False if the command returns an error, true otherwise
|
* @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 = new Process($command);
|
||||||
$process->run();
|
$process->run();
|
||||||
|
@ -178,7 +178,7 @@ class Downloader
|
||||||
$audioOnly = true,
|
$audioOnly = true,
|
||||||
string $from = null,
|
string $from = null,
|
||||||
string $to = null
|
string $to = null
|
||||||
) {
|
): Process {
|
||||||
if (!$this->checkCommand([$this->avconv, '-version'])) {
|
if (!$this->checkCommand([$this->avconv, '-version'])) {
|
||||||
throw new AvconvException($this->avconv);
|
throw new AvconvException($this->avconv);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ class Downloader
|
||||||
* @throws YoutubedlException If youtube-dl returns an error
|
* @throws YoutubedlException If youtube-dl returns an error
|
||||||
* @throws PasswordException If the video is protected by a password and no password was specified
|
* @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);
|
$process = $this->getProcess($arguments);
|
||||||
//This is needed by the openload extractor because it runs PhantomJS
|
//This is needed by the openload extractor because it runs PhantomJS
|
||||||
|
@ -468,7 +468,7 @@ class Downloader
|
||||||
*
|
*
|
||||||
* @throws AlltubeLibraryException
|
* @throws AlltubeLibraryException
|
||||||
*/
|
*/
|
||||||
public function getExtractors()
|
public function getExtractors(): array
|
||||||
{
|
{
|
||||||
return explode("\n", trim($this->callYoutubedl(['--list-extractors'])));
|
return explode("\n", trim($this->callYoutubedl(['--list-extractors'])));
|
||||||
}
|
}
|
||||||
|
@ -484,7 +484,7 @@ class Downloader
|
||||||
* @throws AlltubeLibraryException
|
* @throws AlltubeLibraryException
|
||||||
* @link https://github.com/guzzle/guzzle/issues/2640
|
* @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/.
|
// IDN conversion breaks with Google hosts like https://r3---sn-25glene6.googlevideo.com/.
|
||||||
$client = new Client(['idn_conversion' => false]);
|
$client = new Client(['idn_conversion' => false]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue