Skip to content

Commit

Permalink
Merge pull request #1 from phphacks/OV-12
Browse files Browse the repository at this point in the history
Ov 12
  • Loading branch information
fernandoscolari authored Jul 16, 2018
2 parents 77edebf + 7109944 commit 3e514fb
Show file tree
Hide file tree
Showing 38 changed files with 1,132 additions and 164 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"require": {
"zendframework/zend-mvc": "^3.1",
"respect/validation": "^1.1",
"zendframework/zend-log": "^2.10"
"zendframework/zend-log": "^2.10",
"phphacks/zend-mvc-di": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.2"
"phpunit/phpunit": "^7.2",
"zendframework/zend-test": "^3.2"
},
"license": "MIT",
"autoload": {
Expand Down
220 changes: 214 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

return [
'listeners' => [
"Zend\Mvc\ErrorInterceptor\Listener\ErrorEventListener"
],
'service_manager' => [
'factories' => [
"Zend\Mvc\ErrorInterceptor\Listener\ErrorEventListener" => Zend\Mvc\ErrorInterceptor\Factory\ErrorEventListenerFactory::class
]
]
];
4 changes: 1 addition & 3 deletions src/Common/Enums/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ interface Configuration
const LOGGER = 'logger';
const TYPEOF = 'typeof';
const IGNORED = 'ignored';
const CONFIG = 'config';
const CONFIG_ADAPTER = 'adapter';
const CONFIG_SUBJECTS = 'subjects';
const FACTORY = 'factory';
}
2 changes: 0 additions & 2 deletions src/Common/ErrorLogging.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,4 @@ public function addLogger(LoggerDefinition $logger)
$this->loggers[] = $logger;
}



}
32 changes: 24 additions & 8 deletions src/Common/LoggerDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Zend\Mvc\ErrorInterceptor\Common;

use Exception;

class LoggerDefinition
{
/**
Expand All @@ -20,9 +22,9 @@ class LoggerDefinition
protected $ignored = [];

/**
* @var string[]
* @var string
*/
protected $parameters = [];
protected $factoryName;

/**
* @return string
Expand Down Expand Up @@ -73,20 +75,34 @@ public function setIgnored(array $ignored)
}

/**
* @return string[]
* @return string
*/
public function getFactoryName(): string
{
return $this->factoryName;
}

/**
* @param string $factoryName
*/
public function getParameters(): array
public function setFactoryName(string $factoryName)
{
return $this->parameters;
$this->factoryName = $factoryName;
}

/**
* @param string[] $parameters
* @param Exception $exception
* @return bool
*/
public function setParameters(array $parameters)
public function canLog(Exception $exception): bool
{
$this->parameters = $parameters;
if (in_array(get_class($exception), $this->exceptions) && !in_array(get_class($exception), $this->ignored)){
return true;
}

return false;
}



}
Loading

0 comments on commit 3e514fb

Please sign in to comment.