ExtensionIterator::accept()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: matthew
5
 * Date: 12/1/15
6
 * Time: 11:40 AM
7
 */
8
9
namespace Fyuze\File\Iterators;
10
11
12
class ExtensionIterator extends \FilterIterator
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $extension;
18
19
    /**
20
     * ExtensionIterator constructor.
21
     * @param \Iterator $iterator
22
     * @param $extension
23
     */
24 1
    public function __construct($iterator, $extension)
25
    {
26 1
        parent::__construct($iterator);
27 1
        $this->extension = $extension;
28
29
    }
30
31
    /**
32
     * @return boolean
33
     */
34 1
    public function accept()
35
    {
36 1
        return $this->getInnerIterator()->current()->getExtension() === $this->extension;
37
    }
38
}
39