Coding style - camelCase for variables

This commit is contained in:
Christian Schorn
2012-10-31 19:32:00 +01:00
parent 2b43be92b3
commit 11e662c707
4 changed files with 15 additions and 15 deletions

View File

@@ -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'])

View File

@@ -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)
);
}
}

View File

@@ -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(

View File

@@ -9,8 +9,8 @@
{% for repository in repositories %}
<div class="repository">
<div class="repository-header">
<i class="icon-folder-open icon-spaced"></i> <a href="{{ path('repository', {repo: repository.relative_path}) }}">{{ repository.name }}</a>
<a href="{{ path('rss', {repo: repository.relative_path, branch: 'master'}) }}"><i class="rss pull-right"></i></a>
<i class="icon-folder-open icon-spaced"></i> <a href="{{ path('repository', {repo: repository.relativePath}) }}">{{ repository.name }}</a>
<a href="{{ path('rss', {repo: repository.relativePath, branch: 'master'}) }}"><i class="rss pull-right"></i></a>
</div>
<div class="repository-body">
<p>{{ repository.description }}</p>