Total Complexity | 10 |
Total Lines | 86 |
Duplicated Lines | 0 % |
Coverage | 86.36% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait HasRendererTrait |
||
12 | { |
||
13 | protected $_isRendered = false; |
||
14 | |||
15 | /** |
||
16 | * @param boolean $isRendered |
||
17 | * @return $this |
||
18 | */ |
||
19 | 8 | public function setRendered($isRendered) |
|
20 | { |
||
21 | 8 | $this->_isRendered = (bool)$isRendered; |
|
22 | |||
23 | 8 | return $this; |
|
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return bool |
||
28 | */ |
||
29 | 1 | public function isRendered() |
|
30 | { |
||
31 | 1 | return (bool)$this->_isRendered; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return bool |
||
36 | */ |
||
37 | 1 | public function hasCustomRenderer() |
|
38 | { |
||
39 | 1 | return false; |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return mixed |
||
44 | */ |
||
45 | 5 | public function render() |
|
46 | { |
||
47 | 5 | return $this->getRenderer()->render($this); |
|
|
|||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return AbstractElementRenderer |
||
52 | */ |
||
53 | 6 | public function getRenderer() |
|
54 | { |
||
55 | 6 | return $this->getForm()->getRenderer()->getElementRenderer($this); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return mixed |
||
60 | */ |
||
61 | 1 | public function renderElement() |
|
62 | { |
||
63 | 1 | return $this->getRenderer()->renderElement(); |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return mixed |
||
68 | */ |
||
69 | 1 | public function renderErrors() |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param null|string|array $extraClasses |
||
76 | * @return mixed |
||
77 | */ |
||
78 | 2 | public function renderLabel($extraClasses = null) |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param bool $value |
||
85 | */ |
||
86 | public function setRenderLabel(bool $value) |
||
87 | { |
||
88 | $this->setOption('render_label', $value); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @return bool |
||
93 | */ |
||
94 | 2 | public function isRenderLabel() |
|
97 | } |
||
98 | } |
||
99 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.