Skip to content

Commit 3e514fb

Browse files
Merge pull request #1 from phphacks/OV-12
Ov 12
2 parents 77edebf + 7109944 commit 3e514fb

38 files changed

+1132
-164
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
"require": {
66
"zendframework/zend-mvc": "^3.1",
77
"respect/validation": "^1.1",
8-
"zendframework/zend-log": "^2.10"
8+
"zendframework/zend-log": "^2.10",
9+
"phphacks/zend-mvc-di": "^1.0"
910
},
1011
"require-dev": {
11-
"phpunit/phpunit": "^7.2"
12+
"phpunit/phpunit": "^7.2",
13+
"zendframework/zend-test": "^3.2"
1214
},
1315
"license": "MIT",
1416
"autoload": {

composer.lock

Lines changed: 214 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/module.config.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
return [
4+
'listeners' => [
5+
"Zend\Mvc\ErrorInterceptor\Listener\ErrorEventListener"
6+
],
7+
'service_manager' => [
8+
'factories' => [
9+
"Zend\Mvc\ErrorInterceptor\Listener\ErrorEventListener" => Zend\Mvc\ErrorInterceptor\Factory\ErrorEventListenerFactory::class
10+
]
11+
]
12+
];

src/Common/Enums/Configuration.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ interface Configuration
1111
const LOGGER = 'logger';
1212
const TYPEOF = 'typeof';
1313
const IGNORED = 'ignored';
14-
const CONFIG = 'config';
15-
const CONFIG_ADAPTER = 'adapter';
16-
const CONFIG_SUBJECTS = 'subjects';
14+
const FACTORY = 'factory';
1715
}

src/Common/ErrorLogging.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,4 @@ public function addLogger(LoggerDefinition $logger)
5252
$this->loggers[] = $logger;
5353
}
5454

55-
56-
5755
}

src/Common/LoggerDefinition.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Zend\Mvc\ErrorInterceptor\Common;
44

5+
use Exception;
6+
57
class LoggerDefinition
68
{
79
/**
@@ -20,9 +22,9 @@ class LoggerDefinition
2022
protected $ignored = [];
2123

2224
/**
23-
* @var string[]
25+
* @var string
2426
*/
25-
protected $parameters = [];
27+
protected $factoryName;
2628

2729
/**
2830
* @return string
@@ -73,20 +75,34 @@ public function setIgnored(array $ignored)
7375
}
7476

7577
/**
76-
* @return string[]
78+
* @return string
79+
*/
80+
public function getFactoryName(): string
81+
{
82+
return $this->factoryName;
83+
}
84+
85+
/**
86+
* @param string $factoryName
7787
*/
78-
public function getParameters(): array
88+
public function setFactoryName(string $factoryName)
7989
{
80-
return $this->parameters;
90+
$this->factoryName = $factoryName;
8191
}
8292

8393
/**
84-
* @param string[] $parameters
94+
* @param Exception $exception
95+
* @return bool
8596
*/
86-
public function setParameters(array $parameters)
97+
public function canLog(Exception $exception): bool
8798
{
88-
$this->parameters = $parameters;
99+
if (in_array(get_class($exception), $this->exceptions) && !in_array(get_class($exception), $this->ignored)){
100+
return true;
101+
}
102+
103+
return false;
89104
}
90105

91106

107+
92108
}

0 commit comments

Comments
 (0)