Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
shulard committed Nov 17, 2015
1 parent df6cf90 commit 34963f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
22 changes: 14 additions & 8 deletions Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function resolve(
$arguments = [];
$reflection = null;

$this->populateVariables($variables, $rtv);
$this->populateKit($variables, $rtv);
if ($call instanceof \Closure) {
$called = $call;
$reflection = new \ReflectionMethod($call, '__invoke');
Expand All @@ -92,9 +92,9 @@ protected function resolve(

if (false === $parameter->isOptional()) {
throw new Exception(
'The closured action for the rule with pattern %s needs ' .
'a value for the parameter $%s and this value does not ' .
'exist.',
'The closured action for the rule with pattern %s ' .
'needs a value for the parameter $%s and this value ' .
'does not exist.',
1,
[$rule[Router::RULE_PATTERN], $name]
);
Expand Down Expand Up @@ -123,9 +123,9 @@ protected function resolve(

if (false === $parameter->isOptional()) {
throw new Exception(
'The functional action for the rule with pattern %s needs ' .
'a value for the parameter $%s and this value does not ' .
'exist.',
'The functional action for the rule with pattern %s ' .
'needs a value for the parameter $%s and this value ' .
'does not exist.',
3,
[$rule[Router::RULE_PATTERN], $name]
);
Expand All @@ -138,10 +138,16 @@ protected function resolve(
} else {
$return = $reflection->invokeArgs($called, $arguments);
}

return $return;
}

protected function populateVariables(&$variables, $rtv)
/**
* Populate Dispatcher\Kit in the variable collection
* @param array $variables Variable collection used as resolver parameters
* @param array $rtv Constructor's arguments.
*/
protected function populateKit(&$variables, $rtv)
{
$kitname = $this->getKitName();
if (!empty($kitname)) {
Expand Down
7 changes: 3 additions & 4 deletions Test/Unit/Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function dispatchedMethodOptional($test, $foo, $bar = null)

function closureDispatchedMethodWithKit()
{
return function($test, $_this) {
return function ($test, $_this) {
$test
->object($_this)
->isInstanceOf(__NAMESPACE__ . '\MockKit')
Expand All @@ -71,7 +71,7 @@ function closureDispatchedMethodWithKit()

function closureDispatchedMethod()
{
return function($test, $foo, $bar) {
return function ($test, $foo, $bar) {
dispatchedMethod($test, $foo, $bar);
};
}
Expand Down Expand Up @@ -240,8 +240,7 @@ protected function route(Router $router, $uri, Array $extraVariables = [])
}
}

if( !class_exists(__NAMESPACE__.'\MockKit') ) {

if (!class_exists(__NAMESPACE__ . '\MockKit')) {
class MockKit extends LUT\Kit
{
public $hasBeenConstructed = false;
Expand Down

0 comments on commit 34963f3

Please sign in to comment.