@@ 25-74 (lines=50) @@ | ||
22 | use ArrayAccess; |
|
23 | use IteratorAggregate; |
|
24 | ||
25 | class AttributeMatchCollection implements AttributeCollectionInterface, IteratorAggregate, ArrayAccess |
|
26 | { |
|
27 | /** |
|
28 | * @var AttributeMatch[] |
|
29 | */ |
|
30 | private $matches = []; |
|
31 | ||
32 | /** |
|
33 | * @param string $key |
|
34 | * @param AttributeMatch $attributeMatch |
|
35 | */ |
|
36 | public function add($key, AttributeMatch $attributeMatch) |
|
37 | { |
|
38 | $this->matches[$key] = $attributeMatch; |
|
39 | } |
|
40 | ||
41 | public function getIterator() |
|
42 | { |
|
43 | return new ArrayIterator($this->matches); |
|
44 | } |
|
45 | ||
46 | public function offsetSet($offset, $value) |
|
47 | { |
|
48 | if (is_null($offset)) { |
|
49 | $this->matches[] = $value; |
|
50 | } else { |
|
51 | $this->matches[$offset] = $value; |
|
52 | } |
|
53 | } |
|
54 | ||
55 | public function offsetExists($offset) |
|
56 | { |
|
57 | return isset($this->matches[$offset]); |
|
58 | } |
|
59 | ||
60 | public function offsetUnset($offset) |
|
61 | { |
|
62 | unset($this->matches[$offset]); |
|
63 | } |
|
64 | ||
65 | public function offsetGet($offset) |
|
66 | { |
|
67 | return isset($this->matches[$offset]) ? $this->matches[$offset] : null; |
|
68 | } |
|
69 | ||
70 | public function getAttributes() |
|
71 | { |
|
72 | return $this->matches; |
|
73 | } |
|
74 | } |
|
75 |
@@ 26-66 (lines=41) @@ | ||
23 | use IteratorAggregate; |
|
24 | use Surfnet\StepupSelfService\SelfServiceBundle\Service\RemoteVetting\Dto\AttributeListDto; |
|
25 | ||
26 | class FeedbackCollection implements IteratorAggregate, ArrayAccess, AttributeCollectionInterface |
|
27 | { |
|
28 | /** |
|
29 | * @var array[] |
|
30 | */ |
|
31 | private $feedback = []; |
|
32 | ||
33 | public function getIterator() |
|
34 | { |
|
35 | return new ArrayIterator($this->feedback); |
|
36 | } |
|
37 | ||
38 | public function offsetSet($offset, $value) |
|
39 | { |
|
40 | if (is_null($offset)) { |
|
41 | $this->feedback[] = $value; |
|
42 | } else { |
|
43 | $this->feedback[$offset] = $value; |
|
44 | } |
|
45 | } |
|
46 | ||
47 | public function offsetExists($offset) |
|
48 | { |
|
49 | return isset($this->feedback[$offset]); |
|
50 | } |
|
51 | ||
52 | public function offsetUnset($offset) |
|
53 | { |
|
54 | unset($this->feedback[$offset]); |
|
55 | } |
|
56 | ||
57 | public function offsetGet($offset) |
|
58 | { |
|
59 | return isset($this->feedback[$offset]) ? $this->feedback[$offset] : null; |
|
60 | } |
|
61 | ||
62 | public function getAttributes() |
|
63 | { |
|
64 | return $this->feedback; |
|
65 | } |
|
66 | } |
|
67 |