diff --git a/classes/PlaylistArchiveStream.php b/classes/PlaylistArchiveStream.php index b12867d..c97f6b8 100644 --- a/classes/PlaylistArchiveStream.php +++ b/classes/PlaylistArchiveStream.php @@ -94,10 +94,10 @@ class PlaylistArchiveStream extends TarArchive $this->buffer = fopen('php://temp', 'r+'); foreach (explode(';', parse_url($path, PHP_URL_HOST)) as $url) { $this->files[] = [ - 'url' => urldecode($url), - 'headersSent'=> false, - 'complete' => false, - 'stream' => null, + 'url' => urldecode($url), + 'headersSent' => false, + 'complete' => false, + 'stream' => null, ]; } @@ -124,7 +124,7 @@ class PlaylistArchiveStream extends TarArchive { //We need this so Slim won't try to get the size of the stream return [ - 'mode'=> 0010000, + 'mode' => 0010000, ]; } diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index a1c45a2..dfbbdb0 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -195,12 +195,12 @@ class VideoDownload private function addOptionsToRtmpProcess(ProcessBuilder $builder, $video) { foreach ([ - 'url' => 'rtmp', - 'webpage_url' => 'pageUrl', - 'player_url' => 'swfVfy', + 'url' => 'rtmp', + 'webpage_url' => 'pageUrl', + 'player_url' => 'swfVfy', 'flash_version' => 'flashVer', - 'play_path' => 'playpath', - 'app' => 'app', + 'play_path' => 'playpath', + 'app' => 'app', ] as $property => $option) { if (isset($video->{$property})) { $builder->add('--'.$option); diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 12a3fd2..87d8b02 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -158,8 +158,8 @@ class FrontController 'title' => 'Supported websites', 'description' => 'List of all supported websites from which Alltube Download '. 'can extract video or audio files', - 'canonical' => $this->getCanonicalUrl($request), - 'locale' => $this->localeManager->getLocale(), + 'canonical' => $this->getCanonicalUrl($request), + 'locale' => $this->localeManager->getLocale(), ] ); diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index c72ff60..f8bd064 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -162,7 +162,7 @@ class FrontControllerTest extends TestCase */ public function testConstructorWithStream() { - $controller = new FrontController($this->container, new Config(['stream'=>true])); + $controller = new FrontController($this->container, new Config(['stream' => true])); $this->assertInstanceOf(FrontController::class, $controller); } @@ -185,7 +185,7 @@ class FrontControllerTest extends TestCase { $result = $this->controller->index( Request::createFromEnvironment( - Environment::mock(['REQUEST_URI'=>'/foo', 'QUERY_STRING'=>'foo=bar']) + Environment::mock(['REQUEST_URI' => '/foo', 'QUERY_STRING' => 'foo=bar']) ), $this->response ); @@ -229,7 +229,7 @@ class FrontControllerTest extends TestCase */ public function testVideo() { - $this->assertRequestIsOk('video', ['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']); + $this->assertRequestIsOk('video', ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU']); } /** @@ -240,7 +240,7 @@ class FrontControllerTest extends TestCase public function testVideoWithoutTitle() { $this->markTestSkipped('This URL triggers a curl SSL error on Travis'); - $this->assertRequestIsOk('video', ['url'=>'http://html5demos.com/video']); + $this->assertRequestIsOk('video', ['url' => 'http://html5demos.com/video']); } /** @@ -250,7 +250,7 @@ class FrontControllerTest extends TestCase */ public function testVideoWithAudio() { - $this->assertRequestIsOk('video', ['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio'=>true]); + $this->assertRequestIsOk('video', ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio' => true]); } /** @@ -262,7 +262,7 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsRedirect( 'video', - ['url'=> 'https://2080.bandcamp.com/track/cygnus-x-the-orange-theme-2080-faulty-chip-cover', 'audio'=>true] + ['url' => 'https://2080.bandcamp.com/track/cygnus-x-the-orange-theme-2080-faulty-chip-cover', 'audio' => true] ); } @@ -274,8 +274,8 @@ class FrontControllerTest extends TestCase public function testVideoWithPassword() { $result = $this->controller->video( - $this->request->withQueryParams(['url'=>'http://vimeo.com/68375962']) - ->withParsedBody(['password'=>'youtube-dl']), + $this->request->withQueryParams(['url' => 'http://vimeo.com/68375962']) + ->withParsedBody(['password' => 'youtube-dl']), $this->response ); $this->assertTrue($result->isOk()); @@ -288,8 +288,8 @@ class FrontControllerTest extends TestCase */ public function testVideoWithMissingPassword() { - $this->assertRequestIsOk('video', ['url'=>'http://vimeo.com/68375962']); - $this->assertRequestIsOk('video', ['url'=>'http://vimeo.com/68375962', 'audio'=>true]); + $this->assertRequestIsOk('video', ['url' => 'http://vimeo.com/68375962']); + $this->assertRequestIsOk('video', ['url' => 'http://vimeo.com/68375962', 'audio' => true]); } /** @@ -299,11 +299,11 @@ class FrontControllerTest extends TestCase */ public function testVideoWithStream() { - $config = new Config(['stream'=>true]); - $this->assertRequestIsOk('video', ['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU'], $config); + $config = new Config(['stream' => true]); + $this->assertRequestIsOk('video', ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU'], $config); $this->assertRequestIsOk( 'video', - ['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio'=>true], + ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio' => true], $config ); } @@ -317,7 +317,7 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsOk( 'video', - ['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'] + ['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'] ); } @@ -349,7 +349,7 @@ class FrontControllerTest extends TestCase */ public function testRedirect() { - $this->assertRequestIsRedirect('redirect', ['url'=>'https://www.youtube.com/watch?v=M7IpKCZ47pU']); + $this->assertRequestIsRedirect('redirect', ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU']); } /** @@ -361,7 +361,7 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsRedirect( 'redirect', - ['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format'=>'worst'] + ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format' => 'worst'] ); } @@ -374,8 +374,8 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsOk( 'redirect', - ['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU'], - new Config(['stream'=>true]) + ['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU'], + new Config(['stream' => true]) ); } @@ -388,8 +388,8 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsOk( 'redirect', - ['url'=> 'https://twitter.com/verge/status/813055465324056576/video/1'], - new Config(['stream'=>true]) + ['url' => 'https://twitter.com/verge/status/813055465324056576/video/1'], + new Config(['stream' => true]) ); } @@ -402,8 +402,8 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsOk( 'redirect', - ['url'=> 'http://www.canalc2.tv/video/12163', 'format'=>'rtmp'], - new Config(['stream'=>true]) + ['url' => 'http://www.canalc2.tv/video/12163', 'format' => 'rtmp'], + new Config(['stream' => true]) ); } @@ -417,10 +417,10 @@ class FrontControllerTest extends TestCase $this->assertRequestIsOk( 'redirect', [ - 'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', - 'format'=> 'bestvideo+bestaudio', + 'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', + 'format' => 'bestvideo+bestaudio', ], - new Config(['remux'=>true]) + new Config(['remux' => true]) ); } @@ -434,8 +434,8 @@ class FrontControllerTest extends TestCase $this->assertRequestIsServerError( 'redirect', [ - 'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', - 'format'=> 'bestvideo+bestaudio', + 'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', + 'format' => 'bestvideo+bestaudio', ] ); } @@ -447,7 +447,7 @@ class FrontControllerTest extends TestCase */ public function testRedirectWithMissingPassword() { - $this->assertRequestIsRedirect('redirect', ['url'=>'http://vimeo.com/68375962']); + $this->assertRequestIsRedirect('redirect', ['url' => 'http://vimeo.com/68375962']); } /** @@ -457,7 +457,7 @@ class FrontControllerTest extends TestCase */ public function testRedirectWithError() { - $this->assertRequestIsServerError('redirect', ['url'=>'http://example.com/foo']); + $this->assertRequestIsServerError('redirect', ['url' => 'http://example.com/foo']); } /** @@ -470,7 +470,7 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsServerError( 'redirect', - ['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'] + ['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'] ); } @@ -483,8 +483,8 @@ class FrontControllerTest extends TestCase { $this->assertRequestIsOk( 'redirect', - ['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'], - new Config(['stream'=>true]) + ['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'], + new Config(['stream' => true]) ); } @@ -499,7 +499,7 @@ class FrontControllerTest extends TestCase $this->controller->locale( $this->request, $this->response, - ['locale'=> 'fr_FR'] + ['locale' => 'fr_FR'] )->isRedirect() ); } diff --git a/tests/LocaleMiddlewareTest.php b/tests/LocaleMiddlewareTest.php index 0f4e2ae..1845327 100644 --- a/tests/LocaleMiddlewareTest.php +++ b/tests/LocaleMiddlewareTest.php @@ -44,8 +44,8 @@ class LocaleMiddlewareTest extends TestCase { $this->markTestSkipped('For some reason, this test fails on Travis even if the fr_FR locale is installed.'); $locale = [ - 'language'=> 'fr', - 'region' => 'FR', + 'language' => 'fr', + 'region' => 'FR', ]; $this->assertEquals('fr_FR', $this->middleware->testLocale($locale)); } @@ -58,8 +58,8 @@ class LocaleMiddlewareTest extends TestCase public function testLocaleWithWrongLocale() { $locale = [ - 'language'=> 'foo', - 'region' => 'BAR', + 'language' => 'foo', + 'region' => 'BAR', ]; $this->assertNull($this->middleware->testLocale($locale)); $this->assertNull($this->middleware->testLocale([])); diff --git a/tests/PlaylistArchiveStreamTest.php b/tests/PlaylistArchiveStreamTest.php index c986416..2e3e4a7 100644 --- a/tests/PlaylistArchiveStreamTest.php +++ b/tests/PlaylistArchiveStreamTest.php @@ -55,7 +55,7 @@ class PlaylistArchiveStreamTest extends TestCase */ public function testStreamStat() { - $this->assertEquals(['mode'=>4096], $this->stream->stream_stat()); + $this->assertEquals(['mode' => 4096], $this->stream->stream_stat()); } /** diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 68f6e51..ed5d75c 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -364,7 +364,7 @@ class VideoDownloadTest extends TestCase */ public function testGetAudioStreamAvconvError($url, $format) { - $download = new VideoDownload(new Config(['avconv'=>'foobar'])); + $download = new VideoDownload(new Config(['avconv' => 'foobar'])); $download->getAudioStream($url, $format); } @@ -380,7 +380,7 @@ class VideoDownloadTest extends TestCase */ public function testGetAudioStreamRtmpError($url, $format) { - $download = new VideoDownload(new Config(['rtmpdump'=>'foobar'])); + $download = new VideoDownload(new Config(['rtmpdump' => 'foobar'])); $download->getAudioStream($url, $format); } @@ -477,7 +477,7 @@ class VideoDownloadTest extends TestCase */ public function testGetM3uStreamAvconvError($url, $format) { - $download = new VideoDownload(new Config(['avconv'=>'foobar'])); + $download = new VideoDownload(new Config(['avconv' => 'foobar'])); $video = $download->getJSON($url, $format); $download->getM3uStream($video); }