IteratorFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 49
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A newMappingIterator() 0 3 1
A newRecursiveMembersIterator() 0 3 1
A newRecursiveIteratorIterator() 0 3 1
A newChildlessRecursiveIterator() 0 3 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