1 | <?php |
||
38 | class Set implements SetInterface, ArrayAccess, Countable, IteratorAggregate |
||
39 | { |
||
40 | protected $changes = null; |
||
41 | |||
42 | public function __construct(AbstractSnapshot $old = null, AbstractSnapshot $new = null) |
||
48 | |||
49 | /** |
||
50 | * {@inheritDoc} |
||
51 | * |
||
52 | * @throws OutOfBoundsException The property doesn't exist or wasn't changed |
||
53 | */ |
||
54 | public function getChange($property) |
||
62 | |||
63 | /** |
||
64 | * {@inheritDoc} |
||
65 | * |
||
66 | * @throws RuntimeException If the changeset was not computed yet |
||
67 | */ |
||
68 | public function hasChanged($property) |
||
76 | |||
77 | /** {@inheritDoc} */ |
||
78 | public function offsetExists($offset) |
||
82 | |||
83 | /** {@inheritDoc} */ |
||
84 | public function offsetGet($offset) |
||
88 | |||
89 | /** |
||
90 | * {@inheritDoc} |
||
91 | * |
||
92 | * @throws BadMethodCallException if a unset is tried on a snapshot property |
||
93 | */ |
||
94 | public function offsetSet($offset, $value) |
||
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | * |
||
102 | * @throws BadMethodCallException if a unset is tried on a snapshot property |
||
103 | */ |
||
104 | public function offsetUnset($offset) |
||
108 | |||
109 | /** |
||
110 | * {@inheritDoc} |
||
111 | * |
||
112 | * @throws RuntimeException If the changeset was not computed yet |
||
113 | */ |
||
114 | public function count() |
||
122 | |||
123 | /** |
||
124 | * {@inheritDoc} |
||
125 | * |
||
126 | * @throws RuntimeException If the changeset was not computed yet |
||
127 | */ |
||
128 | public function getIterator() |
||
136 | |||
137 | /** {@inheritDoc} */ |
||
138 | public function compute(AbstractSnapshot $old, AbstractSnapshot $new) |
||
162 | |||
163 | /** |
||
164 | * Calculate the difference between two snapshots for a given key |
||
165 | * |
||
166 | * @param mixed $key Key to compare |
||
167 | * |
||
168 | * @return AbstractChange|null a change if a change was detected, null otherwise |
||
|
|||
169 | * @internal |
||
170 | */ |
||
171 | private function computeEntry(AbstractSnapshot $old, AbstractSnapshot $new, $key) |
||
217 | |||
218 | /** |
||
219 | * Extracts the raw data for a given value |
||
220 | * |
||
221 | * @param mixed $value Value to extract |
||
222 | * @return mixed value extracted |
||
223 | */ |
||
224 | private function getRawData($value) |
||
232 | } |
||
233 | |||
234 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.