From 31efed8bc98509e57f869355649e1d21075b42df Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 16 Jan 2017 16:31:20 +0000 Subject: [PATCH] Apply fixes from StyleCI --- controllers/FrontController.php | 35 +++++++++++------- tests/FrontControllerTest.php | 63 +++++++++++++++++++++------------ tests/bootstrap.php | 4 +-- 3 files changed, 65 insertions(+), 37 deletions(-) diff --git a/controllers/FrontController.php b/controllers/FrontController.php index 2126211..98b753b 100644 --- a/controllers/FrontController.php +++ b/controllers/FrontController.php @@ -98,6 +98,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -123,6 +124,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -146,15 +148,18 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } /** - * Return the converted MP3 file - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * @param array $params GET query parameters - * @param string $password Video password + * Return the converted MP3 file. + * + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * * @return Response */ private function getAudioResponse(Request $request, Response $response, array $params, $password = null) @@ -187,11 +192,13 @@ class FrontController } /** - * Return the video description page - * @param Request $request PSR-7 request - * @param Response $response PSR-7 response - * @param array $params GET query parameters - * @param string $password Video password + * Return the video description page. + * + * @param Request $request PSR-7 request + * @param Response $response PSR-7 response + * @param array $params GET query parameters + * @param string $password Video password + * * @return Response */ private function getVideoResponse(Request $request, Response $response, array $params, $password = null) @@ -219,6 +226,7 @@ class FrontController 'canonical' => $this->getCanonicalUrl($request), ] ); + return $response; } @@ -354,10 +362,11 @@ class FrontController } } - /** - * Generate the canonical URL of the current page - * @param Request $request PSR-7 Request + * Generate the canonical URL of the current page. + * + * @param Request $request PSR-7 Request + * * @return string URL */ private function getCanonicalUrl(Request $request) diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index f04d9d5..ace68ea 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -5,8 +5,8 @@ namespace Alltube\Test; -use Alltube\Controller\FrontController; use Alltube\Config; +use Alltube\Controller\FrontController; use Slim\Container; use Slim\Http\Environment; use Slim\Http\Request; @@ -56,7 +56,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the constructor with streams enabled + * Test the constructor with streams enabled. + * * @return void */ public function testConstructorWithStream() @@ -68,7 +69,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the index() function + * Test the index() function. + * * @return void */ public function testIndex() @@ -78,7 +80,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the index() function with a custom URI + * Test the index() function with a custom URI. + * * @return void */ public function testIndexWithCustomUri() @@ -93,7 +96,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the extractors() function + * Test the extractors() function. + * * @return void */ public function testExtractors() @@ -103,7 +107,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the password() function + * Test the password() function. + * * @return void */ public function testPassword() @@ -113,7 +118,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function without the url parameter + * Test the video() function without the url parameter. + * * @return void */ public function testVideoWithoutUrl() @@ -123,7 +129,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function + * Test the video() function. + * * @return void */ public function testVideo() @@ -136,7 +143,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with audio conversion + * Test the video() function with audio conversion. + * * @return void */ public function testVideoWithAudio() @@ -149,15 +157,16 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with audio enabled and an URL that doesn't need to be converted + * Test the video() function with audio enabled and an URL that doesn't need to be converted. + * * @return void */ public function testVideoWithUnconvertedAudio() { $result = $this->controller->video( $this->request->withQueryParams( - ['url'=>'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', - 'audio'=>true] + ['url' => 'https://soundcloud.com/verwandlungskuenstler/metamorphosis-by-franz-kafka-1', + 'audio'=> true, ] ), $this->response ); @@ -165,7 +174,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with a password + * Test the video() function with a password. + * * @return void */ public function testVideoWithPassword() @@ -179,7 +189,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with a missing password + * Test the video() function with a missing password. + * * @return void */ public function testVideoWithMissingPassword() @@ -197,7 +208,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the video() function with streams enabled + * Test the video() function with streams enabled. + * * @return void */ public function testVideoWithStream() @@ -217,7 +229,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the error() function + * Test the error() function. + * * @return void */ public function testError() @@ -227,7 +240,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function without the URL parameter + * Test the redirect() function without the URL parameter. + * * @return void */ public function testRedirectWithoutUrl() @@ -237,7 +251,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function + * Test the redirect() function. + * * @return void */ public function testRedirect() @@ -250,7 +265,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with streams enabled + * Test the redirect() function with streams enabled. + * * @return void */ public function testRedirectWithStream() @@ -265,7 +281,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with an M3U stream + * Test the redirect() function with an M3U stream. + * * @return void */ public function testRedirectWithM3uStream() @@ -280,7 +297,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with a missing password + * Test the redirect() function with a missing password. + * * @return void */ public function testRedirectWithMissingPassword() @@ -293,7 +311,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase } /** - * Test the redirect() function with an error + * Test the redirect() function with an error. + * * @return void */ public function testRedirectWithError() diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3913383..074ec50 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,10 +1,10 @@