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

Nip_Form_Element_Hidden::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
class Nip_Form_Element_Hidden extends Nip_Form_Element_Input_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
    protected $_type = 'hidden';
5
6
    public function init()
7
    {
8
        parent::init();
9
        $this->setAttrib('type', 'hidden');
10
    }
11
12
    public function getDataFromRequest($request)
13
    {
14
        if ($this->getOption('readRequest') === true) {
0 ignored issues
show
introduced by
The condition $this->getOption('readRequest') === true is always false.
Loading history...
Bug introduced by
Are you sure the usage of $this->getOption('readRequest') targeting Nip\Form\Elements\AbstractElement::getOption() 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...
15
            return parent::getDataFromRequest($request);
16
        }
17
18
        return $this;
19
    }
20
}
21