style(phpcs): Switch to PSR-12

https://www.php-fig.org/psr/psr-12/
This commit is contained in:
Pierre Rudloff 2019-10-03 21:24:12 +02:00
parent f063f2ead4
commit 44bf858c35
35 changed files with 101 additions and 67 deletions

View file

@ -1,4 +1,5 @@
<?php
/**
* BaseController class.
*/

View file

@ -1,4 +1,5 @@
<?php
/**
* DownloadController class.
*/
@ -49,7 +50,8 @@ class DownloadController extends BaseController
return $this->getDownloadResponse($request, $response);
} catch (PasswordException $e) {
return $response->withRedirect(
$this->container->get('router')->pathFor('info').'?'.http_build_query($request->getQueryParams())
$this->container->get('router')->pathFor('info') .
'?' . http_build_query($request->getQueryParams())
);
} catch (Exception $e) {
$response->getBody()->write($e->getMessage());
@ -76,8 +78,8 @@ class DownloadController extends BaseController
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.
$this->video->getFileNameWithExtension('mp3').'"'
'attachment; filename="' .
$this->video->getFileNameWithExtension('mp3') . '"'
);
$response = $response->withHeader('Content-Type', 'audio/mpeg');
@ -153,15 +155,15 @@ class DownloadController extends BaseController
$response = $response->withHeader('Content-Type', 'application/zip');
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.$this->video->title.'.zip"'
'attachment; filename="' . $this->video->title . '.zip"'
);
return $response->withBody($stream);
} elseif ($this->video->protocol == 'rtmp') {
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext);
$response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
$body = new Stream($this->video->getRtmpStream());
} elseif ($this->video->protocol == 'm3u8' || $this->video->protocol == 'm3u8_native') {
$response = $response->withHeader('Content-Type', 'video/'.$this->video->ext);
$response = $response->withHeader('Content-Type', 'video/' . $this->video->ext);
$body = new Stream($this->video->getM3uStream());
} else {
$headers = (array) $this->video->http_headers;
@ -192,8 +194,8 @@ class DownloadController extends BaseController
}
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.
$this->video->getFilename().'"'
'attachment; filename="' .
$this->video->getFilename() . '"'
);
return $response;
@ -220,7 +222,7 @@ class DownloadController extends BaseController
return $response->withHeader(
'Content-Disposition',
'attachment; filename="'.$this->video->getFileNameWithExtension('mkv')
'attachment; filename="' . $this->video->getFileNameWithExtension('mkv')
);
}
@ -269,10 +271,10 @@ class DownloadController extends BaseController
{
$response = $response->withHeader(
'Content-Disposition',
'attachment; filename="'.
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')).'"'
'attachment; filename="' .
$this->video->getFileNameWithExtension($request->getQueryParam('customFormat')) . '"'
);
$response = $response->withHeader('Content-Type', 'video/'.$request->getQueryParam('customFormat'));
$response = $response->withHeader('Content-Type', 'video/' . $request->getQueryParam('customFormat'));
if ($request->isGet() || $request->isPost()) {
$process = $this->video->getConvertedStream(

View file

@ -1,4 +1,5 @@
<?php
/**
* FrontController class.
*/
@ -66,7 +67,7 @@ class FrontController extends BaseController
'config' => $this->config,
'class' => 'index',
'description' => _('Easily download videos from Youtube, Dailymotion, Vimeo and other websites.'),
'domain' => $uri->getScheme().'://'.$uri->getAuthority(),
'domain' => $uri->getScheme() . '://' . $uri->getAuthority(),
'canonical' => $this->getCanonicalUrl($request),
'supportedLocales' => $this->localeManager->getSupportedLocales(),
'locale' => $this->localeManager->getLocale(),
@ -110,7 +111,7 @@ class FrontController extends BaseController
'extractors' => Video::getExtractors(),
'class' => 'extractors',
'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'),
'canonical' => $this->getCanonicalUrl($request),
'locale' => $this->localeManager->getLocale(),
@ -168,10 +169,11 @@ class FrontController extends BaseController
$template = 'info.tpl';
}
$title = _('Video download');
$description = _('Download video from ').$this->video->extractor_key;
$description = _('Download video from ') . $this->video->extractor_key;
if (isset($this->video->title)) {
$title = $this->video->title;
$description = _('Download').' "'.$this->video->title.'" '._('from').' '.$this->video->extractor_key;
$description = _('Download') . ' "' . $this->video->title . '" ' .
_('from') . ' ' . $this->video->extractor_key;
}
$this->view->render(
$response,
@ -209,8 +211,8 @@ class FrontController extends BaseController
if ($this->config->convert && $request->getQueryParam('audio')) {
// We skip the info page and get directly to the download.
return $response->withRedirect(
$this->container->get('router')->pathFor('download').
'?'.http_build_query($request->getQueryParams())
$this->container->get('router')->pathFor('download') .
'?' . http_build_query($request->getQueryParams())
);
} else {
return $this->getInfoResponse($request, $response);
@ -266,7 +268,7 @@ class FrontController extends BaseController
$query = $uri->getQuery();
if (!empty($query)) {
$return .= '?'.$query;
$return .= '?' . $query;
}
return $return;

View file

@ -1,4 +1,5 @@
<?php
/**
* JsonController class.
*/