Skip to content

Commit 51d3ba6

Browse files
committed
version 1 released - Zend Expressive 3 ready
1 parent ae3b40f commit 51d3ba6

4 files changed

Lines changed: 27 additions & 33 deletions

File tree

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"license": "MIT",
66
"authors": [
77
{
8-
"name": "n3vrax",
9-
"email": "tibi@apidemia.com"
8+
"name": "dotkernel",
9+
"email": "team@dotkernel.com"
1010
}
1111
],
1212
"require": {
@@ -36,8 +36,8 @@
3636
},
3737
"extra": {
3838
"branch-alias": {
39-
"dev-master": "0.3-dev",
40-
"dev-develop": "0.4-dev"
39+
"dev-master": "1.0-dev",
40+
"dev-develop": "1.1-dev"
4141
}
4242
}
4343
}

src/AbstractActionController.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function dispatch(): ResponseInterface
3333
if (method_exists($this, $action)) {
3434
$r = $this->dispatchEvent(ControllerEvent::EVENT_CONTROLLER_BEFORE_DISPATCH, [
3535
'request' => $this->request,
36-
'delegate' => $this->getDelegate(),
36+
'handler' => $this->getHandler(),
3737
'controller' => $this,
3838
'method' => $action
3939
]);
@@ -50,16 +50,11 @@ public function dispatch(): ResponseInterface
5050
return $r;
5151
}
5252

53-
$eventResponse = $r->getParam('response');
54-
if ($eventResponse instanceof ResponseInterface) {
55-
$response = $eventResponse;
56-
}
57-
5853
return $response;
5954
}
6055

6156
//just go the the next middleware, it will eventually hit a 404 if no one handles the request
62-
$delegate = $this->getDelegate();
63-
return $delegate->process($this->request);
57+
$handler = $this->getHandler();
58+
return $handler->handle($this->request);
6459
}
6560
}

src/AbstractController.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@
88
declare(strict_types = 1);
99

1010
namespace Dot\Controller;
11-
1211
use Dot\Controller\Event\DispatchControllerEventsTrait;
1312
use Dot\Controller\Exception\RuntimeException;
1413
use Dot\Controller\Plugin\PluginInterface;
1514
use Dot\Controller\Plugin\PluginManager;
1615
use Dot\Controller\Plugin\PluginManagerAwareInterface;
17-
use Interop\Http\ServerMiddleware\DelegateInterface;
18-
use Interop\Http\ServerMiddleware\MiddlewareInterface;
1916
use Psr\Http\Message\ResponseInterface;
2017
use Psr\Http\Message\ServerRequestInterface;
18+
use Psr\Http\Server\MiddlewareInterface;
19+
use Psr\Http\Server\RequestHandlerInterface;
2120
use Zend\EventManager\EventManagerAwareInterface;
22-
use Zend\ServiceManager\ServiceManager;
21+
2322

2423
/**
2524
* Class AbstractController
@@ -38,8 +37,9 @@ abstract class AbstractController implements
3837
/** @var ServerRequestInterface */
3938
protected $request;
4039

41-
/** @var DelegateInterface */
42-
protected $delegate;
40+
/** @var RequestHandlerInterface */
41+
protected $handler;
42+
4343

4444
/** @var bool */
4545
protected $debug = false;
@@ -60,10 +60,10 @@ public static function getMethodFromAction(string $action): string
6060
return $method;
6161
}
6262

63-
public function process(ServerRequestInterface $request, DelegateInterface $delegate): ResponseInterface
63+
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
6464
{
6565
$this->request = $request;
66-
$this->delegate = $delegate;
66+
$this->handler = $handler;
6767

6868
return $this->dispatch();
6969
}
@@ -79,11 +79,11 @@ public function getRequest(): ServerRequestInterface
7979
}
8080

8181
/**
82-
* @return DelegateInterface
82+
* @return RequestHandlerInterface
8383
*/
84-
public function getDelegate(): DelegateInterface
84+
public function getHandler(): RequestHandlerInterface
8585
{
86-
return $this->delegate;
86+
return $this->handler;
8787
}
8888

8989
/**
@@ -132,6 +132,7 @@ public function getPluginManager(): PluginManager
132132
)
133133
);
134134
}
135+
135136
return $this->pluginManager;
136137
}
137138

src/ConfigProvider.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<?php
2-
/**
3-
* @see https://github.com/dotkernel/dot-controller/ for the canonical source repository
4-
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com)
5-
* @license https://github.com/dotkernel/dot-controller/blob/master/LICENSE.md MIT License
6-
*/
72

8-
declare(strict_types = 1);
3+
declare(strict_types=1);
94

105
namespace Dot\Controller;
116

@@ -14,12 +9,15 @@
149
use Dot\Controller\Factory\PluginManagerFactory;
1510
use Dot\Controller\Plugin\PluginManager;
1611

17-
/**
18-
* Class ConfigProvider
19-
* @package Dot\Controller
20-
*/
2112
class ConfigProvider
2213
{
14+
/**
15+
* Returns the configuration array
16+
*
17+
* To add a bit of a structure, each section is defined in a separate
18+
* method which returns an array with its configuration.
19+
*
20+
*/
2321
public function __invoke(): array
2422
{
2523
return [

0 commit comments

Comments
 (0)