Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbankowski committed Sep 26, 2013
1 parent e2aae7c commit 3bf4308
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/Ouzo/Uri.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Ouzo;

use Ouzo\Uri\PathProvider;
use Ouzo\Utilities\Arrays;
use Ouzo\Utilities\Strings;

class Uri
Expand All @@ -9,7 +11,7 @@ class Uri

public function __construct($pathProvider = null)
{
$this->_pathProvider = $pathProvider == null ? new \Ouzo\Uri\PathProvider() : $pathProvider;
$this->_pathProvider = $pathProvider == null ? new PathProvider() : $pathProvider;
}

public function getParams()
Expand Down Expand Up @@ -51,28 +53,27 @@ private function _parseParams($params)
public function getParam($param)
{
$params = $this->getParams();
return isset($params[$param]) ? $params[$param] : null;
return Arrays::getValue($params, $param);
}

public function getRawController()
{
$path = $this->_pathProvider->getPath();
$pathElements = $this->_parsePath($path);
return (isset($pathElements[0]) ? $pathElements[0] : null);
return Arrays::firstOrNull($pathElements);
}

public function getController()
{
$rawController = $this->getRawController();
return isset($rawController) ? Strings::underscoreToCamelCase($rawController) : null;
return $rawController ? Strings::underscoreToCamelCase($rawController) : null;
}

public function getAction()
{
$path = $this->_pathProvider->getPath();
$pathElements = $this->_parsePath($path);

return isset($pathElements[1]) ? $pathElements[1] : null;
return Arrays::getValue($pathElements, 1);
}

private function _parsePath($path = null, $limit = null)
Expand Down

0 comments on commit 3bf4308

Please sign in to comment.