Completed
Push — master ( a07def...5584d6 )
by Gabriel
04:52 queued 12s
created

Nip_Form_Renderer_Button_Abstract::getItemAttribs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
use Nip\Form\Renderer\AbstractRenderer;
4
use Nip\Form\Buttons\AbstractButton;
5
6
/**
7
 * Class Nip_Form_Renderer_Button_Abstract
8
 */
9
abstract class Nip_Form_Renderer_Button_Abstract
10
{
11
    use \Nip\Form\Renderer\Traits\HasAttribsTrait;
12
13
    protected $_renderer;
14
    protected $_button;
15
16
    /**
17
     * @param AbstractRenderer $renderer
18
     * @return $this
19
     */
20 1
    public function setRenderer(AbstractRenderer $renderer)
21
    {
22 1
        $this->_renderer = $renderer;
23
24 1
        return $this;
25
    }
26
27
    /**
28
     * @return AbstractRenderer
29
     */
30
    public function getRenderer()
31
    {
32
        return $this->_renderer;
33
    }
34
35
    /**
36
     * @param AbstractButton $item
37
     * @return $this
38
     */
39 1
    public function setItem(AbstractButton $item)
40
    {
41 1
        $this->_item = $item;
0 ignored issues
show
Bug Best Practice introduced by
The property _item does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
42
43 1
        return $this;
44
    }
45
46
    /**
47
     * @return AbstractButton
48
     */
49 1
    public function getItem()
50
    {
51 1
        return $this->_item;
52
    }
53
54
    /**
55
     * @return AbstractButton
56
     */
57 1
    public function getElement()
58
    {
59 1
        return $this->getItem();
60
    }
61
62
63 1
    public function render()
64
    {
65 1
        $return = '';
66 1
        $return .= $this->renderItem();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->renderItem() targeting Nip_Form_Renderer_Button_Abstract::renderItem() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
67
68 1
        return $return;
69
    }
70
71 1
    public function renderItem()
72
    {
73 1
        $return = $this->generateItem();
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $return is correct as $this->generateItem() targeting Nip_Form_Renderer_Button_Abstract::generateItem() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
74
75 1
        return $return;
76
    }
77
78
    public function generateItem()
79
    {
80
        return;
81
    }
82
83
84
}
85