80% of 152OPs |
79% of 14Lines |
81% of 21Branches |
75% of 12Paths |
Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
---|---|---|---|---|---|---|---|---|
mageekguy\atoum\iterators\recursives\atoum\source::__construct() | 42 | 100% | 5 | 100% | 5 | 80% | 2 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::getSourceDirectory() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::getPharDirectory() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::getInnerIterator() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::current() | 20 | 100% | 2 | 100% | 5 | 100% | 2 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::key() | 42 | 100% | 1 | 100% | 5 | 100% | 2 | 100% |
mageekguy\atoum\iterators\recursives\atoum\source::next() | 10 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
mageekguy\atoum\iterators\recursives\atoum\source::rewind() | 10 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
mageekguy\atoum\iterators\recursives\atoum\source::valid() | 10 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\iterators\recursives\atoum; |
4 |
|
5 |
use |
6 |
mageekguy\atoum, |
7 |
mageekguy\atoum\iterators |
8 |
; |
9 |
|
10 |
class source implements \outerIterator |
11 |
{ |
12 |
protected $pharDirectory = ''; |
13 |
protected $sourceDirectory = ''; |
14 |
protected $innerIterator = null; |
15 |
|
16 |
public function __construct($sourceDirectory, $pharDirectory = null)100% |
17 |
{ |
18 |
$this->sourceDirectory = (string) $sourceDirectory; |
19 |
$this->pharDirectory = $pharDirectory === null ? null : (string) $pharDirectory; |
20 |
$this->innerIterator = new \recursiveIteratorIterator(new iterators\filters\recursives\atoum\source($this->sourceDirectory)); |
21 |
|
22 |
$this->innerIterator->rewind(); |
23 |
} |
24 |
|
25 |
public function getSourceDirectory()100% |
26 |
{ |
27 |
return $this->sourceDirectory; |
28 |
} |
29 |
|
30 |
public function getPharDirectory()100% |
31 |
{ |
32 |
return $this->pharDirectory; |
33 |
} |
34 |
|
35 |
public function getInnerIterator()100% |
36 |
{ |
37 |
return $this->innerIterator; |
38 |
} |
39 |
|
40 |
public function current()100% |
41 |
{ |
42 |
$current = $this->innerIterator->current(); |
43 |
|
44 |
return $current === null ? null : (string) $current; |
45 |
} |
46 |
|
47 |
public function key()100% |
48 |
{ |
49 |
return ($this->pharDirectory === null ? $this->innerIterator->key() : preg_replace('#^(:[^:]+://)?' . preg_quote($this->sourceDirectory, '#') . '#', $this->pharDirectory, $this->innerIterator->current()) ?: null); |
50 |
} |
51 |
|
52 |
public function next()0% |
53 |
{ |
54 |
return $this->innerIterator->next(); |
55 |
} |
56 |
|
57 |
public function rewind()0% |
58 |
{ |
59 |
return $this->innerIterator->rewind(); |
60 |
} |
61 |
|
62 |
public function valid()0% |
63 |
{ |
64 |
return $this->innerIterator->valid(); |
65 |
} |
66 |
} |