Passed
Push — master ( 0f7ce3...d7b14c )
by Gabriel
11:25 queued 12s
created

Nip_Form_Renderer_Elements_Dateinput::generateElementJavscript()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 31
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 20
c 0
b 0
f 0
dl 0
loc 31
ccs 0
cts 14
cp 0
rs 9.6
cc 2
nc 2
nop 0
crap 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A Nip_Form_Renderer_Elements_Dateinput::getElementAttribs() 0 7 1
1
<?php
2
3
class Nip_Form_Renderer_Elements_Dateinput extends Nip_Form_Renderer_Elements_Input
4
{
5
    public function generateElement()
6
    {
7
        if (!$this->getElement()->getAttrib('id')) {
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getElement()->getAttrib('id') targeting Nip\Form\Elements\AbstractElement::getAttrib() 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...
8
            $this->getElement()->setAttrib('id', $this->getElement()->getJSID());
9
        }
10
        $return = parent::generateElement();
11
        return $return;
12
    }
13
14
    /**
15
     * @return array
16
     */
17
    public function getElementAttribs(): array
18
    {
19
        $attribs = parent::getElementAttribs();
20
        $attribs[] = 'min';
21
        $attribs[] = 'max';
22
23
        return $attribs;
24
    }
25
}
26