ErrorHandlerTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
getCurrentNode() 0 1 ?
A getErrorInfo() 0 4 1
A setError() 0 8 1
1
<?php
2
3
/*
4
 *  @author Serkin Akexander <[email protected]>
5
 */
6
7
namespace Volan\Traits;
8
9
trait ErrorHandlerTrait
10
{
11
12
    /**
13
     * @var array
14
     */
15
    private $error;
16
17
    /**
18
     * @return array
19
     */
20
    public function getErrorInfo()
21
    {
22
        return $this->error;
23
    }
24
25
    abstract public function getCurrentNode();
26
27
28
    /**
29
     * @param string $message
30
     * @param int    $code
31
     */
32
    private function setError($message, $code)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
33
    {
34
        $this->error = [
35
            'code'  => $code,
36
            'error' => $message,
37
            'node'  => $this->getCurrentNode()
38
                ];
39
    }
40
}
41