Lint
This commit is contained in:
parent
f8a82839a7
commit
d443cb3996
7 changed files with 53 additions and 53 deletions
|
@ -94,10 +94,10 @@ class PlaylistArchiveStream extends TarArchive
|
||||||
$this->buffer = fopen('php://temp', 'r+');
|
$this->buffer = fopen('php://temp', 'r+');
|
||||||
foreach (explode(';', parse_url($path, PHP_URL_HOST)) as $url) {
|
foreach (explode(';', parse_url($path, PHP_URL_HOST)) as $url) {
|
||||||
$this->files[] = [
|
$this->files[] = [
|
||||||
'url' => urldecode($url),
|
'url' => urldecode($url),
|
||||||
'headersSent'=> false,
|
'headersSent' => false,
|
||||||
'complete' => false,
|
'complete' => false,
|
||||||
'stream' => null,
|
'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
|
//We need this so Slim won't try to get the size of the stream
|
||||||
return [
|
return [
|
||||||
'mode'=> 0010000,
|
'mode' => 0010000,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,12 +195,12 @@ class VideoDownload
|
||||||
private function addOptionsToRtmpProcess(ProcessBuilder $builder, $video)
|
private function addOptionsToRtmpProcess(ProcessBuilder $builder, $video)
|
||||||
{
|
{
|
||||||
foreach ([
|
foreach ([
|
||||||
'url' => 'rtmp',
|
'url' => 'rtmp',
|
||||||
'webpage_url' => 'pageUrl',
|
'webpage_url' => 'pageUrl',
|
||||||
'player_url' => 'swfVfy',
|
'player_url' => 'swfVfy',
|
||||||
'flash_version' => 'flashVer',
|
'flash_version' => 'flashVer',
|
||||||
'play_path' => 'playpath',
|
'play_path' => 'playpath',
|
||||||
'app' => 'app',
|
'app' => 'app',
|
||||||
] as $property => $option) {
|
] as $property => $option) {
|
||||||
if (isset($video->{$property})) {
|
if (isset($video->{$property})) {
|
||||||
$builder->add('--'.$option);
|
$builder->add('--'.$option);
|
||||||
|
|
|
@ -158,8 +158,8 @@ class FrontController
|
||||||
'title' => 'Supported websites',
|
'title' => 'Supported websites',
|
||||||
'description' => 'List of all supported websites from which Alltube Download '.
|
'description' => 'List of all supported websites from which Alltube Download '.
|
||||||
'can extract video or audio files',
|
'can extract video or audio files',
|
||||||
'canonical' => $this->getCanonicalUrl($request),
|
'canonical' => $this->getCanonicalUrl($request),
|
||||||
'locale' => $this->localeManager->getLocale(),
|
'locale' => $this->localeManager->getLocale(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testConstructorWithStream()
|
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);
|
$this->assertInstanceOf(FrontController::class, $controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$result = $this->controller->index(
|
$result = $this->controller->index(
|
||||||
Request::createFromEnvironment(
|
Request::createFromEnvironment(
|
||||||
Environment::mock(['REQUEST_URI'=>'/foo', 'QUERY_STRING'=>'foo=bar'])
|
Environment::mock(['REQUEST_URI' => '/foo', 'QUERY_STRING' => 'foo=bar'])
|
||||||
),
|
),
|
||||||
$this->response
|
$this->response
|
||||||
);
|
);
|
||||||
|
@ -228,7 +228,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVideo()
|
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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +239,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testVideoWithoutTitle()
|
public function testVideoWithoutTitle()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('This URL triggers a curl SSL error on Travis');
|
$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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVideoWithAudio()
|
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -261,7 +261,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsRedirect(
|
$this->assertRequestIsRedirect(
|
||||||
'video',
|
'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]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,8 +273,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testVideoWithPassword()
|
public function testVideoWithPassword()
|
||||||
{
|
{
|
||||||
$result = $this->controller->video(
|
$result = $this->controller->video(
|
||||||
$this->request->withQueryParams(['url'=>'http://vimeo.com/68375962'])
|
$this->request->withQueryParams(['url' => 'http://vimeo.com/68375962'])
|
||||||
->withParsedBody(['password'=>'youtube-dl']),
|
->withParsedBody(['password' => 'youtube-dl']),
|
||||||
$this->response
|
$this->response
|
||||||
);
|
);
|
||||||
$this->assertTrue($result->isOk());
|
$this->assertTrue($result->isOk());
|
||||||
|
@ -287,8 +287,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVideoWithMissingPassword()
|
public function testVideoWithMissingPassword()
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk('video', ['url'=>'http://vimeo.com/68375962']);
|
$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', 'audio' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -298,11 +298,11 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVideoWithStream()
|
public function testVideoWithStream()
|
||||||
{
|
{
|
||||||
$config = new Config(['stream'=>true]);
|
$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'], $config);
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'video',
|
'video',
|
||||||
['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio'=>true],
|
['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'audio' => true],
|
||||||
$config
|
$config
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'video',
|
'video',
|
||||||
['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC']
|
['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testRedirect()
|
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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -360,7 +360,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsRedirect(
|
$this->assertRequestIsRedirect(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format'=>'worst']
|
['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU', 'format' => 'worst']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,8 +373,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'https://www.youtube.com/watch?v=M7IpKCZ47pU'],
|
['url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU'],
|
||||||
new Config(['stream'=>true])
|
new Config(['stream' => true])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,8 +387,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'https://twitter.com/verge/status/813055465324056576/video/1'],
|
['url' => 'https://twitter.com/verge/status/813055465324056576/video/1'],
|
||||||
new Config(['stream'=>true])
|
new Config(['stream' => true])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,8 +401,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'http://www.canalc2.tv/video/12163', 'format'=>'rtmp'],
|
['url' => 'http://www.canalc2.tv/video/12163', 'format' => 'rtmp'],
|
||||||
new Config(['stream'=>true])
|
new Config(['stream' => true])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,10 +416,10 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'redirect',
|
'redirect',
|
||||||
[
|
[
|
||||||
'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU',
|
'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU',
|
||||||
'format'=> 'bestvideo+bestaudio',
|
'format' => 'bestvideo+bestaudio',
|
||||||
],
|
],
|
||||||
new Config(['remux'=>true])
|
new Config(['remux' => true])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,8 +433,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertRequestIsServerError(
|
$this->assertRequestIsServerError(
|
||||||
'redirect',
|
'redirect',
|
||||||
[
|
[
|
||||||
'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU',
|
'url' => 'https://www.youtube.com/watch?v=M7IpKCZ47pU',
|
||||||
'format'=> 'bestvideo+bestaudio',
|
'format' => 'bestvideo+bestaudio',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testRedirectWithMissingPassword()
|
public function testRedirectWithMissingPassword()
|
||||||
{
|
{
|
||||||
$this->assertRequestIsRedirect('redirect', ['url'=>'http://vimeo.com/68375962']);
|
$this->assertRequestIsRedirect('redirect', ['url' => 'http://vimeo.com/68375962']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -456,7 +456,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testRedirectWithError()
|
public function testRedirectWithError()
|
||||||
{
|
{
|
||||||
$this->assertRequestIsServerError('redirect', ['url'=>'http://example.com/foo']);
|
$this->assertRequestIsServerError('redirect', ['url' => 'http://example.com/foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -469,7 +469,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsServerError(
|
$this->assertRequestIsServerError(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC']
|
['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,8 +482,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
'redirect',
|
'redirect',
|
||||||
['url'=> 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'],
|
['url' => 'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC'],
|
||||||
new Config(['stream'=>true])
|
new Config(['stream' => true])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->controller->locale(
|
$this->controller->locale(
|
||||||
$this->request,
|
$this->request,
|
||||||
$this->response,
|
$this->response,
|
||||||
['locale'=> 'fr_FR']
|
['locale' => 'fr_FR']
|
||||||
)->isRedirect()
|
)->isRedirect()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,8 @@ class LocaleMiddlewareTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->markTestSkipped('For some reason, this test fails on Travis even if the fr_FR locale is installed.');
|
$this->markTestSkipped('For some reason, this test fails on Travis even if the fr_FR locale is installed.');
|
||||||
$locale = [
|
$locale = [
|
||||||
'language'=> 'fr',
|
'language' => 'fr',
|
||||||
'region' => 'FR',
|
'region' => 'FR',
|
||||||
];
|
];
|
||||||
$this->assertEquals('fr_FR', $this->middleware->testLocale($locale));
|
$this->assertEquals('fr_FR', $this->middleware->testLocale($locale));
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,8 @@ class LocaleMiddlewareTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testLocaleWithWrongLocale()
|
public function testLocaleWithWrongLocale()
|
||||||
{
|
{
|
||||||
$locale = [
|
$locale = [
|
||||||
'language'=> 'foo',
|
'language' => 'foo',
|
||||||
'region' => 'BAR',
|
'region' => 'BAR',
|
||||||
];
|
];
|
||||||
$this->assertNull($this->middleware->testLocale($locale));
|
$this->assertNull($this->middleware->testLocale($locale));
|
||||||
$this->assertNull($this->middleware->testLocale([]));
|
$this->assertNull($this->middleware->testLocale([]));
|
||||||
|
|
|
@ -54,7 +54,7 @@ class PlaylistArchiveStreamTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testStreamStat()
|
public function testStreamStat()
|
||||||
{
|
{
|
||||||
$this->assertEquals(['mode'=>4096], $this->stream->stream_stat());
|
$this->assertEquals(['mode' => 4096], $this->stream->stream_stat());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -363,7 +363,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamAvconvError($url, $format)
|
public function testGetAudioStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
$download = new VideoDownload(new Config(['avconv' => 'foobar']));
|
||||||
$download->getAudioStream($url, $format);
|
$download->getAudioStream($url, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamRtmpError($url, $format)
|
public function testGetAudioStreamRtmpError($url, $format)
|
||||||
{
|
{
|
||||||
$download = new VideoDownload(new Config(['rtmpdump'=>'foobar']));
|
$download = new VideoDownload(new Config(['rtmpdump' => 'foobar']));
|
||||||
$download->getAudioStream($url, $format);
|
$download->getAudioStream($url, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetM3uStreamAvconvError($url, $format)
|
public function testGetM3uStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
$download = new VideoDownload(new Config(['avconv' => 'foobar']));
|
||||||
$video = $download->getJSON($url, $format);
|
$video = $download->getJSON($url, $format);
|
||||||
$download->getM3uStream($video);
|
$download->getM3uStream($video);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue