Completed
Push — master ( 0cf5bd...a3625c )
by mw
11s
created

IteratorFactory::newRecursiveMembersIterator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
namespace SMW\Notifications;
4
5
use SMW\Store;
6
use SMW\Notifications\Iterators\MappingIterator;
7
use SMW\Notifications\Iterators\RecursiveMembersIterator;
8
use SMW\Notifications\Iterators\ChildlessRecursiveIterator;
9
use Iterator;
10
use RecursiveIterator;
11
use RecursiveIteratorIterator;
12
13
/**
14
 * @license GNU GPL v2+
15
 * @since 1.0
16
 *
17
 * @author mwjames
18
 */
19
class IteratorFactory {
20
21
	/**
22
	 * @since 1.0
23
	 *
24
	 * @param array|Iterator $iterator
25
	 * @param callable $callback
26
	 *
27
	 * @return MappingIterator
28
	 */
29 1
	public function newMappingIterator( $iterator, callable $callback ) {
30 1
		return new MappingIterator( $iterator, $callback );
31
	}
32
33
	/**
34
	 * @since 1.0
35
	 *
36
	 * @param array|Iterator $iterator
37
	 * @param Store $store
38
	 *
39
	 * @return RecursiveMembersIterator
40
	 */
41 1
	public function newRecursiveMembersIterator( $iterator, Store $store ) {
42 1
		return new RecursiveMembersIterator( $iterator, $store );
43
	}
44
45
	/**
46
	 * @since 1.0
47
	 *
48
	 * @param RecursiveIterator $recursiveIterator
49
	 *
50
	 * @return RecursiveIteratorIterator
51
	 */
52 1
	public function newRecursiveIteratorIterator( RecursiveIterator $recursiveIterator ) {
53 1
		return new RecursiveIteratorIterator( $recursiveIterator );
54
	}
55
56
	/**
57
	 * @since 1.0
58
	 *
59
	 * @param Iterator|array $iterator
60
	 *
61
	 * @return ChildlessRecursiveIterator
62
	 */
63 1
	public function newChildlessRecursiveIterator( $iterator ) {
64 1
		return new ChildlessRecursiveIterator( $iterator );
65
	}
66
67
}
68