From 11e662c707f6e324d66a280bce3a633795734b3a Mon Sep 17 00:00:00 2001 From: Christian Schorn Date: Wed, 31 Oct 2012 19:32:00 +0100 Subject: [PATCH] Coding style - camelCase for variables --- src/GitList/Controller/MainController.php | 2 +- src/GitList/Util/Routing.php | 18 +++++++++--------- tests/InterfaceTest.php | 6 +++--- views/index.twig | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/GitList/Controller/MainController.php b/src/GitList/Controller/MainController.php index a223721..89b6f62 100644 --- a/src/GitList/Controller/MainController.php +++ b/src/GitList/Controller/MainController.php @@ -15,7 +15,7 @@ class MainController implements ControllerProviderInterface $route->get('/', function() use ($app) { $repositories = array_map( function ($repo) use ($app) { - $repo['relative_path'] = $app['util.routing']->getRelativePath($repo['path']); + $repo['relativePath'] = $app['util.routing']->getRelativePath($repo['path']); return $repo; }, $app['git']->getRepositories($app['git.repos']) diff --git a/src/GitList/Util/Routing.php b/src/GitList/Util/Routing.php index 0f22dae..884e251 100644 --- a/src/GitList/Util/Routing.php +++ b/src/GitList/Util/Routing.php @@ -19,14 +19,14 @@ class Routing if ($regex === null) { $app = $this->app; - $quoted_paths = array_map( + $quotedPaths = array_map( function ($repo) use ($app) { return preg_quote($app['util.routing']->getRelativePath($repo['path']), '#'); }, $this->app['git']->getRepositories($this->app['git.repos']) ); - usort($quoted_paths, function ($a, $b) { return strlen($b) - strlen($a); }); - $regex = implode('|', $quoted_paths); + usort($quotedPaths, function ($a, $b) { return strlen($b) - strlen($a); }); + $regex = implode('|', $quotedPaths); } return $regex; @@ -35,17 +35,17 @@ class Routing /** * Strips the base path from a full repository path * - * @param string $repo_path Full path to the repository + * @param string $repoPath Full path to the repository * @return string Relative path to the repository from git.repositories */ - public function getRelativePath($repo_path) + public function getRelativePath($repoPath) { - if (strpos($repo_path, $this->app['git.repos']) === 0) { - $relative_path = substr($repo_path, strlen($this->app['git.repos'])); - return ltrim($relative_path, '/'); + if (strpos($repoPath, $this->app['git.repos']) === 0) { + $relativePath = substr($repoPath, strlen($this->app['git.repos'])); + return ltrim($relativePath, '/'); } else { throw new \InvalidArgumentException( - sprintf("Path '%s' does not match configured repository directory", $repo_path) + sprintf("Path '%s' does not match configured repository directory", $repoPath) ); } } diff --git a/tests/InterfaceTest.php b/tests/InterfaceTest.php index d475158..38e437d 100644 --- a/tests/InterfaceTest.php +++ b/tests/InterfaceTest.php @@ -7,7 +7,7 @@ use Gitter\Client; class InterfaceTest extends WebTestCase { protected static $tmpdir; - protected static $git_path; + protected static $gitPath; public static function setUpBeforeClass() { @@ -32,7 +32,7 @@ class InterfaceTest extends WebTestCase $options['hidden'] = array(self::$tmpdir . '/hiddenrepo'); $git = new Client($options); - self::$git_path = $options['path']; + self::$gitPath = $options['path']; // GitTest repository fixture $git->createRepository(self::$tmpdir . 'GitTest'); @@ -85,7 +85,7 @@ class InterfaceTest extends WebTestCase { $config = new \GitList\Config(array( 'git' => array( - 'client' => self::$git_path, + 'client' => self::$gitPath, 'repositories' => self::$tmpdir, ), 'app' => array( diff --git a/views/index.twig b/views/index.twig index 898fd20..07093cd 100644 --- a/views/index.twig +++ b/views/index.twig @@ -9,8 +9,8 @@ {% for repository in repositories %}

{{ repository.description }}