1 | <?php |
||
31 | final class InstitutionCollection implements IteratorAggregate, JsonSerializable, SerializableInterface |
||
32 | { |
||
33 | private $elements = []; |
||
34 | |||
35 | public function __construct(array $institutions = []) |
||
41 | |||
42 | public function contains(Institution $institution) |
||
46 | |||
47 | /** |
||
48 | * Adds the institution to this collection |
||
49 | * |
||
50 | * @param Institution $institution |
||
51 | * @throws RuntimeException when the institution already exists in this collection |
||
52 | */ |
||
53 | public function add(Institution $institution) |
||
64 | |||
65 | /** |
||
66 | * @param $institution |
||
67 | */ |
||
68 | private function addIgnoringDuplicates($institution) |
||
75 | |||
76 | /** |
||
77 | * Adds all institutions from the given collection to this collection |
||
78 | * |
||
79 | * @param InstitutionCollection $institutionCollection |
||
80 | */ |
||
81 | public function addAllFrom(InstitutionCollection $institutionCollection) |
||
87 | |||
88 | /** |
||
89 | * Merges the two collections, ignores duplicates |
||
90 | * @param InstitutionCollection $institutionCollection |
||
91 | */ |
||
92 | public function merge(InstitutionCollection $institutionCollection) |
||
98 | |||
99 | /** |
||
100 | * Removes an institution from this collection |
||
101 | * |
||
102 | * @param Institution $institution |
||
103 | * @throws RuntimeException when the institution to remove is not in this collection |
||
104 | */ |
||
105 | public function remove(Institution $institution) |
||
119 | |||
120 | /** |
||
121 | * Removes all Institutions in the given collection from this collection |
||
122 | * |
||
123 | * @param InstitutionCollection $institutionCollection |
||
124 | */ |
||
125 | public function removeAllIn(InstitutionCollection $institutionCollection) |
||
131 | |||
132 | public function jsonSerialize() |
||
136 | |||
137 | public static function deserialize(array $data) |
||
145 | |||
146 | public function serialize() |
||
152 | |||
153 | public function getIterator() |
||
157 | |||
158 | public function isEmpty() |
||
162 | } |
||
163 |