1 | <?php |
||
32 | class ReflectionCollection implements Collection, ResultCollectionConvertible |
||
33 | { |
||
34 | |||
35 | use PairStackable; |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @param \cloak\reflection\Reflection[] $reflections |
||
40 | */ |
||
41 | public function __construct(array $reflections = []) |
||
42 | { |
||
43 | $this->collection = new Map(); |
||
44 | $this->addAll($reflections); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param Reflection $reflection |
||
49 | */ |
||
50 | public function add(Reflection $reflection) |
||
51 | { |
||
52 | $identityName = $reflection->getIdentityName(); |
||
53 | $this->collection->set($identityName, $reflection); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param Reflection[] $reflections |
||
58 | */ |
||
59 | public function addAll(array $reflections) |
||
63 | |||
64 | /** |
||
65 | * @param ReflectionCollection $reflections |
||
66 | */ |
||
67 | public function merge(ReflectionCollection $reflections) |
||
71 | |||
72 | /** |
||
73 | * @param Iterator $reflections |
||
74 | */ |
||
75 | private function pushAll(Iterator $reflections) |
||
81 | |||
82 | /** |
||
83 | * @param callable $filter |
||
84 | * @return ReflectionCollection |
||
85 | */ |
||
86 | public function filter(Closure $filter) |
||
91 | |||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | public function convertToResult(LineResultSelectable $selector) |
||
108 | |||
109 | } |
||
110 |