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

Nip_Form_Element_Hidden   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDataFromRequest() 0 7 2
A init() 0 4 1
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