Method   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 109
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

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

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A setController() 0 9 2
A end() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A setInjectionKeys() 0 6 1
A getInjectionKeys() 0 4 1
A hasInjectionKeys() 0 4 2
A __toArray() 0 8 1
1
<?php
2
3
namespace Saxulum\SaxulumControllerProvider\Map;
4
5
class Method
6
{
7
    /**
8
     * @var Controller
9
     */
10
    protected $controller;
11
12
    /**
13
     * @var string
14
     */
15
    protected $name;
16
17
    /**
18
     * @var array
19
     */
20
    protected $injectionKeys = array();
21
22
    /**
23
     * @param array $methodInjectionInfo
24
     */
25
    public function __construct(array $methodInjectionInfo = null)
26
    {
27
        if (!is_null($methodInjectionInfo)) {
28
            $this->setName($methodInjectionInfo['name']);
29
            $this->setInjectionKeys($methodInjectionInfo['injectionKeys']);
30
        }
31
    }
32
33
    /**
34
     * @param  Controller $controller
35
     * @param  bool       $stopPropagation
36
     * @return $this
37
     */
38
    public function setController(Controller $controller, $stopPropagation = false)
39
    {
40
        if (!$stopPropagation) {
41
            $controller->addMethod($this, true);
42
        }
43
        $this->controller = $controller;
44
45
        return $this;
46
    }
47
48
    /**
49
     * @return Controller
50
     */
51
    public function end()
52
    {
53
        return $this->controller;
54
    }
55
56
    /**
57
     * @param  string $name
58
     * @return $this
59
     */
60
    public function setName($name)
61
    {
62
        $this->name = $name;
63
64
        return $this;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getName()
71
    {
72
        return $this->name;
73
    }
74
75
    /**
76
     * @param  array $injectionKeys
77
     * @return $this
78
     */
79
    public function setInjectionKeys($injectionKeys)
80
    {
81
        $this->injectionKeys = $injectionKeys;
82
83
        return $this;
84
    }
85
86
    /**
87
     * @return array
88
     */
89
    public function getInjectionKeys()
90
    {
91
        return $this->injectionKeys;
92
    }
93
94
    /**
95
     * @return bool
96
     */
97
    public function hasInjectionKeys()
98
    {
99
        return $this->injectionKeys ? true : false;
100
    }
101
102
    /**
103
     * @return array
104
     */
105
    public function __toArray()
106
    {
107
        $methodInjectionInfo = array();
108
        $methodInjectionInfo['name'] = $this->getName();
109
        $methodInjectionInfo['injectionKeys'] = $this->getInjectionKeys();
110
111
        return $methodInjectionInfo;
112
    }
113
}
114