@@ -18,7 +18,7 @@ |
||
| 18 | 18 | throw DownloadException::downloadError('Error opening file: ' . $url); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if(($wh = fopen($outfile, 'wb')) === false){ |
|
| 21 | + if (($wh = fopen($outfile, 'wb')) === false) { |
|
| 22 | 22 | throw DownloadException::downloadError('Error creating file: ' . $outfile); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $options->setAllowedTypes('force', 'bool'); |
| 36 | 36 | $options->setAllowedTypes('overwrite', 'bool'); |
| 37 | - $options->setAllowedTypes('video_id', ['string','integer']); |
|
| 37 | + $options->setAllowedTypes('video_id', ['string', 'integer']); |
|
| 38 | 38 | $this->options = $options->resolve($config); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | protected function getFormats() : array |
| 77 | 77 | { |
| 78 | - if(!isset($this->options['format'])){ |
|
| 78 | + if (!isset($this->options['format'])) { |
|
| 79 | 79 | return []; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(is_scalar($this->options['format'])){ |
|
| 82 | + if (is_scalar($this->options['format'])) { |
|
| 83 | 83 | return [$this->options['format']]; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | protected function filterByFormats(array $possibleResults) : array{ |
| 91 | - if($this->getFormats() != []) { |
|
| 91 | + if ($this->getFormats() != []) { |
|
| 92 | 92 | foreach ($this->getFormats() as $selectedFormat) { |
| 93 | 93 | if (isset($possibleResults[$selectedFormat])) { |
| 94 | 94 | return [$selectedFormat => $possibleResults[$selectedFormat]]; |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | public function parse(string $publicWatchUrl) : ?string{ |
| 19 | 19 | preg_match($this->downloaderClass::getPublicUrlRegex(), $publicWatchUrl, $matches); |
| 20 | - if(isset($matches[1])){ |
|
| 20 | + if (isset($matches[1])) { |
|
| 21 | 21 | return $matches[1]; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @param string $name |
| 9 | 9 | * @return DownloadException |
| 10 | 10 | */ |
| 11 | - public static function invalidName(string $name){ |
|
| 11 | + public static function invalidName(string $name) { |
|
| 12 | 12 | return new DownloadException(sprintf('Downloader type "%s" not found', $name)); |
| 13 | 13 | } |
| 14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @param string $publicUrl |
| 17 | 17 | * @return DownloadException |
| 18 | 18 | */ |
| 19 | - public static function invalidPublicUrl(string $publicUrl){ |
|
| 19 | + public static function invalidPublicUrl(string $publicUrl) { |
|
| 20 | 20 | return new DownloadException('Downloader not found [trying to parse: ' . $publicUrl . ']'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -60,9 +60,9 @@ |
||
| 60 | 60 | * @throws DownloadException |
| 61 | 61 | */ |
| 62 | 62 | public function getDownloaderByPublicUrl(string $publicUrl, $config = []) : DownloaderInterface{ |
| 63 | - foreach ($this->getRegisteredDownloaders() as $downloaderClass){ |
|
| 63 | + foreach ($this->getRegisteredDownloaders() as $downloaderClass) { |
|
| 64 | 64 | $regexParser = new URLRegexParser($downloaderClass); |
| 65 | - if($regexParser->isValidUrl($publicUrl)){ |
|
| 65 | + if ($regexParser->isValidUrl($publicUrl)) { |
|
| 66 | 66 | return new $downloaderClass($regexParser->parse($publicUrl), $config); |
| 67 | 67 | } |
| 68 | 68 | } |