Skip to content

Commit d3cc9b3

Browse files
committed
corrected factory and documentation
1 parent f6a0ac6 commit d3cc9b3

4 files changed

Lines changed: 47 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## 1.0.1 - 2018-11-27
2+
3+
Corrected factory and config provider.
4+
5+
### Added
6+
* Factory for plain `ErrorHandler`
7+
8+
### Deprecated
9+
* Nothing
10+
11+
### Removed
12+
* Nothing
13+
14+
### Fixed
15+
* Nothing
16+
17+
118
## 1.0.0 - 2018-11-14
219

320
Initial release

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
"require": {
66
"zendframework/zend-expressive": "^3.0",
77
"zendframework/zend-log": "^2.10",
8-
"dotkernel/dot-log": "^1.0"
8+
"dotkernel/dot-log": "^1.0",
9+
"psr/http-message": "^1.0",
10+
"psr/container": "^1.0"
911
},
1012
"license": "MIT",
1113
"authors": [

src/ConfigProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace Dot\ErrorHandler;
66

7-
use Zend\Expressive\Container\ErrorHandlerFactory;
8-
97
class ConfigProvider
108
{
119
public function __invoke()

src/ErrorHandlerFactory.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* @see https://github.com/zendframework/zend-expressive for the canonical source repository
4+
* @copyright Copyright (c) 2016-2017 Zend Technologies USA Inc. (https://www.zend.com)
5+
* @license https://github.com/zendframework/zend-expressive/blob/master/LICENSE.md New BSD License
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace Dot\ErrorHandler;
11+
12+
use Psr\Container\ContainerInterface;
13+
use Psr\Http\Message\ResponseInterface;
14+
use Zend\Expressive\Middleware\ErrorResponseGenerator;
15+
// use Dot\ErrorHandler\ErrorHandler;
16+
17+
class ErrorHandlerFactory
18+
{
19+
public function __invoke(ContainerInterface $container) : ErrorHandler
20+
{
21+
$generator = $container->has(ErrorResponseGenerator::class)
22+
? $container->get(ErrorResponseGenerator::class)
23+
: null;
24+
25+
return new ErrorHandler($container->get(ResponseInterface::class), $generator);
26+
}
27+
}

0 commit comments

Comments
 (0)