Skip to content

Commit 1359676

Browse files
authored
Merge pull request #2 from dotkernel/development
reformat code to psr2, updated dep zend-expressive-helpers to version…
2 parents 6a3ed2d + 081fe37 commit 1359676

13 files changed

Lines changed: 52 additions & 41 deletions

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
},
1818
"require-dev": {
1919
"zendframework/zend-expressive-template": "^1.0",
20-
"zendframework/zend-expressive-helpers": "^2.0",
21-
20+
"zendframework/zend-expressive-helpers": "^3.0",
2221
"phpunit/phpunit": "^4.8",
2322
"squizlabs/php_codesniffer": "^2.3"
2423
},

src/AbstractActionController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public function dispatch()
2424
{
2525
$request = $this->request;
2626
$action = AbstractController::getMethodFromAction(
27-
strtolower($request->getAttribute('action', 'index')));
27+
strtolower($request->getAttribute('action', 'index'))
28+
);
2829

2930
if (method_exists($this, $action)) {
3031
return $this->$action();
@@ -34,4 +35,4 @@ public function dispatch()
3435
$next = $this->getNext();
3536
return $next($this->getRequest(), $this->getResponse());
3637
}
37-
}
38+
}

src/AbstractController.php

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ abstract class AbstractController implements PluginManagerAwareInterface
3232
/** @var callable */
3333
protected $next;
3434

35+
/**
36+
* Transform an "action" token into a method name
37+
*
38+
* @param string $action
39+
* @return string
40+
*/
41+
public static function getMethodFromAction($action)
42+
{
43+
$method = str_replace(['.', '-', '_'], ' ', $action);
44+
$method = ucwords($method);
45+
$method = str_replace(' ', '', $method);
46+
$method = lcfirst($method);
47+
$method .= 'Action';
48+
return $method;
49+
}
50+
3551
/**
3652
* @param ServerRequestInterface $request
3753
* @param ResponseInterface $response
@@ -48,9 +64,10 @@ public function __invoke(
4864
$this->next = $next;
4965

5066
return $this->dispatch();
51-
5267
}
5368

69+
abstract public function dispatch();
70+
5471
/**
5572
* @return ServerRequestInterface
5673
*/
@@ -75,8 +92,6 @@ public function getNext()
7592
return $this->next;
7693
}
7794

78-
public abstract function dispatch();
79-
8095
/**
8196
* Method overloading: return/call plugins
8297
*
@@ -125,22 +140,4 @@ public function setPluginManager(PluginManager $pluginManager)
125140
$this->pluginManager = $pluginManager;
126141
return $this;
127142
}
128-
129-
/**
130-
* Transform an "action" token into a method name
131-
*
132-
* @param string $action
133-
* @return string
134-
*/
135-
public static function getMethodFromAction($action)
136-
{
137-
$method = str_replace(['.', '-', '_'], ' ', $action);
138-
$method = ucwords($method);
139-
$method = str_replace(' ', '', $method);
140-
$method = lcfirst($method);
141-
$method .= 'Action';
142-
return $method;
143-
}
144-
145-
146-
}
143+
}

src/ConfigProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ public function __invoke()
3737
],
3838
];
3939
}
40-
}
40+
}

src/Exception/ExceptionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
interface ExceptionInterface
1717
{
1818

19-
}
19+
}

src/Exception/RuntimeException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
class RuntimeException extends \RuntimeException implements ExceptionInterface
1717
{
1818

19-
}
19+
}

src/Factory/PluginManagerAwareInitializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public function __invoke(ContainerInterface $container, $instance)
3131
$instance->setPluginManager($pluginManager);
3232
}
3333
}
34-
}
34+
}

src/Factory/PluginManagerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ public function __invoke(ContainerInterface $container)
4545

4646
return $pluginManager;
4747
}
48-
}
48+
}

src/Plugin/PluginInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
interface PluginInterface
1717
{
1818

19-
}
19+
}

src/Plugin/PluginManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
class PluginManager extends AbstractPluginManager
1919
{
2020
protected $instanceOf = PluginInterface::class;
21-
}
21+
}

0 commit comments

Comments
 (0)