TriggerErrorHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 3 1
1
<?php
2
/**
3
 * @codingStandardsIgnoreStart
4
 *
5
 * @author       Barney Hanlon <[email protected]>
6
 * @copyright    Barney Hanlon 2017
7
 * @license      https://opensource.org/licenses/MIT
8
 *
9
 * @codingStandardsIgnoreEnd
10
 */
11
12
namespace Shrikeh\GuzzleMiddleware\TimerLogger\Handler\ExceptionHandler;
13
14
use Exception;
15
16
/**
17
 * Class ExceptionHandlerInterface.
18
 */
19
final class TriggerErrorHandler implements ExceptionHandlerInterface
20
{
21
    /**
22
     * @var int
23
     */
24
    private $errorLevel;
25
26
    /**
27
     * TriggerErrorHandler constructor.
28
     *
29
     * @param int $errorLevel the desired error level of exceptions
30
     */
31
    public function __construct($errorLevel = E_USER_NOTICE)
32
    {
33
        $this->errorLevel = $errorLevel;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function handle(Exception $e)
40
    {
41
        trigger_error($e->getMessage(), $this->errorLevel);
42
    }
43
}
44