Completed
Push — master ( 8431a9...0bccd4 )
by Gabriel
04:28
created

getElementAttribs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
class Nip_Form_Renderer_Elements_Textarea extends Nip_Form_Renderer_Elements_Abstract
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
3
{
4
    public function generateElement()
5
    {
6
        $return = '<textarea ';
7
        $return .= $this->renderAttributes();
8
        $return .= ' >' . $this->getElement()->getValue() . '</textarea>';
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->getElement()->getValue() targeting Nip\Form\Elements\AbstractElement::getValue() 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...
9
        return $return;
10
    }
11
12
    public function getElementAttribs()
13
    {
14
        $attribs = parent::getElementAttribs();
15
        $attribs[] = 'rows';
16
        $attribs[] = 'cols';
17
        return $attribs;
18
    }
19
}
20