Permalink
Browse files

Lint

  • Loading branch information...
1 parent c712bc3 commit 3a1d0c4bc7496983047b112d07b3af1a75e28176 @Rudloff committed Jan 10, 2017
Showing with 20 additions and 16 deletions.
  1. +2 −1 classes/Config.php
  2. +8 −7 classes/UglyRouter.php
  3. +3 −3 controllers/FrontController.php
  4. +1 −1 index.php
  5. +6 −4 tests/UglyRouterTest.php
View
@@ -77,7 +77,8 @@ class Config
/**
* Disable URL rewriting.
- * @var boolean
+ *
+ * @var bool
*/
public $uglyUrls = false;
@@ -2,20 +2,21 @@
/**
* UglyRouter class.
*/
+
namespace Alltube;
-use Slim\Router;
use Psr\Http\Message\ServerRequestInterface;
+use Slim\Router;
/**
* Extend Slim's router class in order to disable URL rewriting.
*/
class UglyRouter extends Router
{
/**
- * Dispatch router for HTTP request
+ * Dispatch router for HTTP request.
*
- * @param ServerRequestInterface $request The current HTTP request object
+ * @param ServerRequestInterface $request The current HTTP request object
*
* @return array
*
@@ -36,23 +37,23 @@ public function dispatch(ServerRequestInterface $request)
}
/**
- * Build the path for a named route including the base path
+ * Build the path for a named route including the base path.
*
* @param string $name Route name
* @param array $data Named argument replacement data
* @param array $queryParams Optional query string parameters
*
- * @return string
- *
* @throws \RuntimeException If named route does not exist
* @throws \InvalidArgumentException If required data not provided
+ *
+ * @return string
*/
public function pathFor($name, array $data = [], array $queryParams = [])
{
$url = str_replace('/', '/?page=', $this->relativePathFor($name, $data, $queryParams));
if ($this->basePath) {
- $url = $this->basePath . $url;
+ $url = $this->basePath.$url;
}
return $url;
@@ -84,10 +84,10 @@ public function index(Request $request, Response $response)
$response,
'index.tpl',
[
- 'convert' => $this->config->convert,
+ 'convert' => $this->config->convert,
'uglyUrls' => $this->config->uglyUrls,
- 'class' => 'index',
- 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
+ 'class' => 'index',
+ 'description' => 'Easily download videos from Youtube, Dailymotion, Vimeo and other websites.',
]
);
}
View
@@ -1,8 +1,8 @@
<?php
require_once __DIR__.'/vendor/autoload.php';
-use Alltube\Controller\FrontController;
use Alltube\Config;
+use Alltube\Controller\FrontController;
use Alltube\UglyRouter;
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '/index.php') !== false) {
@@ -6,11 +6,11 @@
namespace Alltube\Test;
use Alltube\UglyRouter;
-use Slim\Http\Request;
-use Slim\Http\Uri;
-use Slim\Http\Headers;
use Slim\Http\Environment;
+use Slim\Http\Headers;
+use Slim\Http\Request;
use Slim\Http\Stream;
+use Slim\Http\Uri;
/**
* Unit tests for the UglyRouter class.
@@ -35,6 +35,7 @@ protected function setUp()
/**
* Test the dispatch() function.
+ *
* @return void
*/
public function testDispatch()
@@ -56,6 +57,7 @@ public function testDispatch()
/**
* Test the pathFor() function.
+ *
* @return void
*/
public function testPathFor()
@@ -68,11 +70,11 @@ public function testPathFor()
/**
* Test the pathFor() function with a base path.
+ *
* @return void
*/
public function testPathForWithBasePath()
{
-
$this->router->setBasePath('/bar');
$this->assertEquals(
'/bar/?page=foo',

0 comments on commit 3a1d0c4

Please sign in to comment.