Completed
Push — fix/56 ( 314f60 )
by Tyler
13:28
created

Component   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 32
ccs 4
cts 6
cp 0.6667
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
     * This array is overwritten in each component
16
     * 
17
     * @var array
18
     */
19
    private $absolutelyDontHandle = [];
20
21
    /**
22
     * Determine if the exception is in the "do not handle" list.
23
     *
24
     * @param  \Exception  $e
25
     * @return bool
26
     */
27 18
    protected function shouldntHandle(Exception $e) {
28 18
        $dontHandle = array_merge($this->dontHandle, $this->absolutelyDontHandle);
29
30 18
        foreach ($dontHandle as $type) {
31
            if ($e instanceof $type) {
32
                return true;
33
            }
34
        }
35
36 18
        return false;
37
    }
38
}