Completed
Push — master ( 0636af...e088fc )
by Adam
07:34
created

Filter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 29
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A accept() 0 8 2
1
<?php
2
/**
3
 * Filter.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
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;
20
use IPub\Widgets\Filters;
21
22
/**
23
 * Widgets status filter
24
 *
25
 * @package        iPublikuj:Widgets!
26
 * @subpackage     Filters
27
 *
28
 * @author         Adam Kadlec <[email protected]>
29
 */
30 1
class Filter extends Filters\FilterIterator
31
{
32
	/**
33
	 * @var integer
34
	 */
35
	protected $status;
36
37
	/**
38
	 * {@inheritdoc}
39
	 */
40
	public function __construct(\Iterator $iterator, array $options = [])
41
	{
42
		parent::__construct($iterator, $options);
43
44
		$this->status = isset($options['status']) ? $options['status'] : NULL;
45
	}
46
47
	/**
48
	 * {@inheritdoc}
49
	 */
50
	public function accept()
51
	{
52
		if ($this->status === NULL) {
53
			return TRUE;
54
		}
55
56
		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...
57
	}
58
}
59