Completed
Push — master ( 356d31...2bbcd7 )
by mw
02:43
created

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