BaseStrategy   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 31
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerHandler() 0 10 2
handle() 0 1 ?
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: toor
5
 * Date: 19.03.18
6
 * Time: 23:20
7
 */
8
9
namespace Symfony\Component\Debug\Extension\Strategies;
10
11
12
use Exception;
13
use Symfony\Component\Debug\Extension\Api\ErrorHandlerInterface;
14
15
/**
16
 * Class BaseStrategy
17
 * @package Symfony\Component\Debug\Extension\Strategies
18
 */
19
abstract class BaseStrategy {
20
21
    /**
22
     * @var ErrorHandlerInterface[] $handlers
23
     */
24
    protected $handlers = array();
25
26
27
    /**
28
     * @param ErrorHandlerInterface $errorHandler
29
     * @param string $type
30
     * @return int
31
     */
32
    public function registerHandler(ErrorHandlerInterface $errorHandler, $type = '') {
33
34
        if ('' === $type) {
35
            return array_push($this->handlers, $errorHandler);
36
        }
37
38
        $this->handlers[$type] = $errorHandler;
39
40
        return count($this->handlers);
41
    }
42
43
44
    /**
45
     * @param Exception $exception
46
     * @return bool Did you manage to process the error
47
     */
48
    abstract public function handle(Exception $exception);
49
}
50