Filter::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 6
1
<?php
2
/**
3
 * Filter.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
8
 * @package        iPublikuj:Widgets!
9
 * @subpackage     Filters
10
 * @since          1.0.0
11
 *
12
 * @date           26.06.15
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\Widgets\Filters\Status;
18
19
use IPub\Widgets\Filters;
20
21
/**
22
 * Widgets status filter
23
 *
24
 * @package        iPublikuj:Widgets!
25
 * @subpackage     Filters
26
 *
27
 * @author         Adam Kadlec <[email protected]>
28
 */
29 1
class Filter extends Filters\FilterIterator
30
{
31
	/**
32
	 * @var integer
33
	 */
34
	protected $status;
35
36
	/**
37
	 * {@inheritdoc}
38
	 */
39
	public function __construct(\Iterator $iterator, array $options = [])
40
	{
41
		parent::__construct($iterator, $options);
42
43
		$this->status = isset($options['status']) ? $options['status'] : NULL;
44
	}
45
46
	/**
47
	 * {@inheritdoc}
48
	 */
49
	public function accept() : bool
50
	{
51
		if ($this->status === NULL) {
52
			return TRUE;
53
		}
54
55
		return $this->status === parent::current()->getStatus();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (current() instead of accept()). Are you sure this is correct? If so, you might want to change this to $this->current().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
56
	}
57
}
58