Skip to content

Commit

Permalink
explicit visiblities
Browse files Browse the repository at this point in the history
  • Loading branch information
henderjon committed Jul 6, 2016
1 parent 3db42e7 commit e0c0c57
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/Dispatcher/AbstractDispatchableController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ abstract class AbstractDispatchableController implements Interfaces\Dispatchable
use DiAwareTrait;
use RouteAwareTrait;

function __construct( $di, $route ){
public function __construct( $di, $route ){
$this->setDi($di);
$this->setRoute($route);
}

function __invoke(){
public function __invoke(){
$action = $this->getRoute()->getAction();

if(method_exists($this, $action)){
Expand Down
4 changes: 2 additions & 2 deletions src/Dispatcher/Interfaces/DispatchableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ interface DispatchableInterface {
* @param RouteInterface $route The Route
* @return void
*/
function __construct( $di, $route );
public function __construct( $di, $route );

/**
* make our object dispatchable
* @return mixed
*/
function __invoke();
public function __invoke();

}
2 changes: 1 addition & 1 deletion src/Dispatcher/Interfaces/DispatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ interface DispatcherInterface {
* @param string $path The path to parse
* @return \Closure
*/
function dispatch( RouteInterface $route );
public function dispatch( RouteInterface $route );

}
12 changes: 6 additions & 6 deletions src/Response/Interfaces/HeadersInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface HeadersInterface {
/**
* @return array
*/
function getHeaders();
public function getHeaders();

/**
* @todo array values, separated with semicolons and comas dependent on their depth
Expand All @@ -20,23 +20,23 @@ function getHeaders();
* @param string $value
* @return string The Composed Header
*/
function setHeader( $key, $value );
public function setHeader( $key, $value );

/**
* Method to generate the correct content-type header for the response
*
* @param string $extension The type to retrieve
* @return string
*/
function setContentType( $extension );
public function setContentType( $extension );

/**
* @param string $url
* @param int $statusCode
* @return void
* @throws \Exception
*/
function setRedirect( $url, $statusCode = 302 );
public function setRedirect( $url, $statusCode = 302 );

/**
* method to to generate the correct HTTP header for the response
Expand All @@ -45,13 +45,13 @@ function setRedirect( $url, $statusCode = 302 );
* @return string
* @throws \Exception
*/
function setStatusCode( $statusCode );
public function setStatusCode( $statusCode );

/**
* @param callable $callback
* @param bool $extra
* @return void
*/
function eachHeader( callable $callback, $extra = false );
public function eachHeader( callable $callback, $extra = false );

}
2 changes: 1 addition & 1 deletion src/Response/Traits/ContentTypeAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public function setContentType( $extension ) {
* @param string $k
* @param string $v
*/
abstract function setHeader($k, $v);
public abstract function setHeader($k, $v);

}
4 changes: 2 additions & 2 deletions src/Response/Traits/RedirectAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function setRedirect( $url, $statusCode = 302 ) {
* @param string $k
* @param string $v
*/
abstract function setHeader($k, $v);
public abstract function setHeader($k, $v);

/**
* @param string $v
*/
abstract function setStatusCode($v);
public abstract function setStatusCode($v);

}
4 changes: 2 additions & 2 deletions src/Router/AbstractRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ abstract class AbstractRouter {
/**
* set the default action
*/
function setDefaultAction($action){
public function setDefaultAction($action){
$this->default_action = $action;
}

Expand All @@ -30,7 +30,7 @@ function setDefaultAction($action){
/**
* set the default format
*/
function setDefaultFormat($format){
public function setDefaultFormat($format){
$this->default_format = $format;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Router/BasicRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BasicRouter extends AbstractRouter implements Interfaces\RouterInterface {
* @param string $path A string representing the path to be parsed -- $_SERVER[REQUEST_URI]
* @return Route
*/
function match($path){
public function match($path){
list($controller, $action, $format, $parameters) = $this->parseRequest($path);
return new Route($controller, $action, $format, $parameters);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Router/Interfaces/RouterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ interface RouterInterface {
* @param string $path The path to parse
* @return \Chevron\Kernel\Router\Route
*/
function match($path);
public function match($path);

}
4 changes: 2 additions & 2 deletions src/Router/RegexRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class RegexRouter extends AbstractRouter implements Interfaces\RouterInterface {
* @param string $path A string representing the path to be parsed -- $_SERVER[REQUEST_URI]
* @return mixed
*/
function match($path){
public function match($path){
if(!$this->patterns){ return null; }

foreach($this->patterns as $regex => $controller){
Expand All @@ -39,7 +39,7 @@ function match($path){
* @param callable $func The callable 'controller'
* @return void
*/
function regex($pattern, callable $func){
public function regex($pattern, callable $func){
$this->patterns[$pattern] = $func;
}

Expand Down
26 changes: 13 additions & 13 deletions src/Router/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Route implements Interfaces\RouteInterface{
* @param array array $params an array of the parsed query string
* @return \Chevron\Router\Route
*/
function __construct($controller, $action = null, $format = null, array $params = []){
public function __construct($controller, $action = null, $format = null, array $params = []){
$this->controller = $controller ?: self::DEFAULT_CONTROLLER;

if($action){
Expand All @@ -68,46 +68,46 @@ function __construct($controller, $action = null, $format = null, array $params
* get the controller
* @return string
*/
function getController(){
public function getController(){
return $this->controller;
}

/**
* get the action
* @return string
*/
function getAction(){
public function getAction(){
return $this->action;
}

/**
* get the format
* @return string
*/
function getFormat(){
public function getFormat(){
return $this->format;
}

/**
* get the params
* @return array
*/
function getParams(){
public function getParams(){
return $this->params;
}

/**
* get a unique 8 char hash of the request
*/
function getHash(){
public function getHash(){
return substr(sha1($this->__toString()), 0, 8);
}

/**
* output the route as an array
* @return array
*/
function toArray(){
public function toArray(){
return [
static::CONTROLLER_KEY => $this->getController(),
static::ACTION_KEY => $this->getAction(),
Expand All @@ -118,7 +118,7 @@ function toArray(){
/**
* create a link looking string from the properties of the route
*/
function __toString(){
public function __toString(){

$route = strtolower(strtr(trim($this->getController(), DIRECTORY_SEPARATOR), "\\", "/")) . "/";

Expand All @@ -142,7 +142,7 @@ function __toString(){
* chance that you're dispatching from a specific namespace
* @param string $namespace The prefix for the link
*/
function link($namespace = ""){
public function link($namespace = ""){
$prefix = "";
if($namespace){
$prefix = strtolower(trim($namespace, "\\/"));
Expand All @@ -156,7 +156,7 @@ function link($namespace = ""){
* @param string $action
* @return string
*/
function setAction($action){
public function setAction($action){
$this->action = $action;
}

Expand All @@ -165,7 +165,7 @@ function setAction($action){
* @param string $format
* @return string
*/
function setFormat($format){
public function setFormat($format){
$this->format = $format;
}

Expand All @@ -174,8 +174,8 @@ function setFormat($format){
* @param array $params
* @return array
*/
function setParams(array $params){
public function setParams(array $params){
$this->params = $params;
}

}
}

0 comments on commit e0c0c57

Please sign in to comment.