Completed
Pull Request — master (#12)
by Tyler
07:15
created

Component   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A shouldntHandle() 0 11 3
1
<?php
2
3
namespace Tylercd100\LERN\Components;
4
5
use Exception;
6
7
abstract class Component {
8
9
    /**
10
     * @var array
11
     */
12
    protected $dontHandle = [];
13
14
    /**
15
     * @var array
16
     */
17
    private $absolutelyDontHandle = [
18
        \Tylercd100\LERN\Exceptions\RecorderFailedException::class,
19
        \Tylercd100\LERN\Exceptions\NotifierFailedException::class,
20
    ];
21
22
    /**
23
     * Determine if the exception is in the "do not handle" list.
24
     *
25
     * @param  \Exception  $e
26
     * @return bool
27
     */
28 21
    protected function shouldntHandle(Exception $e){
29 21
        $dontHandle = array_merge($this->dontHandle,$this->absolutelyDontHandle);
30
31 21
        foreach ($dontHandle as $type) {
32 21
            if ($e instanceof $type) {
33 6
                return true;
34
            }
35 18
        }
36
37 15
        return false;
38
    }
39
}