Skip to content

Commit

Permalink
Merge pull request #8 from dotkernel/issue-5
Browse files Browse the repository at this point in the history
updated composer, badges
  • Loading branch information
bidi47 authored Feb 11, 2022
2 parents 6716d50 + 27f31d5 commit c85dd5b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 1 addition & 0 deletions OSSMETADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
osslifecycle=active
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Logging Error Handler for DotKernel

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-errorhandler)

[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-debugbar/issues)
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-debugbar/network)
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-debugbar/stargazers)
[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-debugbar/blob/main/LICENSE.md)

![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/3.1.1)

## Adding the error handler

* Add the composer package:
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
],
"require": {
"php": "^7.4",
"dotkernel/dot-log": "^3.0",
"laminas/laminas-dependency-plugin": "^2.0",
"laminas/laminas-diactoros": "^2.2",
"mezzio/mezzio": "^3.2",
"laminas/laminas-log": "^2.12",
"dotkernel/dot-log": "^3.0",
"psr/http-message": "^1.0",
"psr/container": "^1.0",
"laminas/laminas-dependency-plugin": "^2.0"
"psr/container": "^1.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 2 additions & 4 deletions src/ErrorHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@

use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Mezzio\Middleware\ErrorResponseGenerator;
// use Dot\ErrorHandler\ErrorHandler;

class ErrorHandlerFactory
{
public function __invoke(ContainerInterface $container) : ErrorHandler
{
$generator = $container->has(ErrorResponseGenerator::class)
? $container->get(ErrorResponseGenerator::class)
$generator = $container->has(\Mezzio\Middleware\ErrorResponseGenerator::class)
? $container->get(\Mezzio\Middleware\ErrorResponseGenerator::class)
: null;

return new ErrorHandler($container->get(ResponseInterface::class), $generator);
Expand Down
5 changes: 2 additions & 3 deletions src/LogErrorHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\MiddlewareInterface;
use Mezzio\Middleware\ErrorResponseGenerator;
use Laminas\Log\LoggerInterface;

class LogErrorHandlerFactory
Expand All @@ -33,8 +32,8 @@ public function __invoke(ContainerInterface $container) : MiddlewareInterface
$logger = $container->get($errorHandlerConfig['logger']);
}

$generator = $container->has(ErrorResponseGenerator::class)
? $container->get(ErrorResponseGenerator::class)
$generator = $container->has(\Mezzio\Middleware\ErrorResponseGenerator::class)
? $container->get(\Mezzio\Middleware\ErrorResponseGenerator::class)
: null;

return new LogErrorHandler($container->get(ResponseInterface::class), $generator, $logger);
Expand Down

0 comments on commit c85dd5b

Please sign in to comment.