Passed
Push — master ( eb0fcb...47bdab )
by Gabriel
04:01 queued 10s
created

Nip_Form_Renderer_Elements_Dateselect::generateElement2()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 32
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 32
ccs 0
cts 22
cp 0
rs 9.552
cc 3
nc 4
nop 0
crap 12
1
<?php
2
3
class Nip_Form_Renderer_Elements_Dateselect extends Nip_Form_Renderer_Elements_MultiElement
4
{
5
    /**
6
     * @inheritDoc
7
     * @noinspection PhpMissingParentCallCommonInspection
8
     */
9
    public function generateElement()
10
    {
11
        $return = '<div class="row">';
12
13
        $elements = $this->getElement()->getElements();
0 ignored issues
show
Bug introduced by
The method getElements() does not exist on Nip_Form_Element_Abstract. It seems like you code against a sub-type of Nip_Form_Element_Abstract such as Nip_Form_Element_MultiElement or Nip_Form_Element_Input_Group. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

13
        $elements = $this->getElement()->/** @scrutinizer ignore-call */ getElements();
Loading history...
14
        $returnElements = [];
15
        foreach ($elements as $key => $element) {
16
            $element->addClass('form-control');
17
            $returnElements[] = '<div class="col col-xs-4" style="max-width:'.($key == 'day' ? 95 : 110).'px;">'.
18
                $element->render().'</div>';
19
        }
20
21
        $return .= implode(' ', $returnElements);
22
        $return .= '</div>';
23
24
        return $return;
25
    }
26
}
27