Skip to content

Commit

Permalink
Coding style - camelCase for variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cschorn committed Oct 31, 2012
1 parent 2b43be9 commit 11e662c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/GitList/Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 15,7 @@ public function connect(Application $app)
$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'])
Expand Down
18 changes: 9 additions & 9 deletions src/GitList/Util/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 19,14 @@ public function getRepositoryRegex()

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;
Expand All @@ -35,17 35,17 @@ function ($repo) use ($app) {
/**
* 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)
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/InterfaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 7,7 @@
class InterfaceTest extends WebTestCase
{
protected static $tmpdir;
protected static $git_path;
protected static $gitPath;

public static function setUpBeforeClass()
{
Expand All @@ -32,7 32,7 @@ public static function setUpBeforeClass()
$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');
Expand Down Expand Up @@ -85,7 85,7 @@ public function createApplication()
{
$config = new \GitList\Config(array(
'git' => array(
'client' => self::$git_path,
'client' => self::$gitPath,
'repositories' => self::$tmpdir,
),
'app' => array(
Expand Down
4 changes: 2 additions & 2 deletions views/index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 11e662c

Please sign in to comment.