| @@ 151-167 (lines=17) @@ | ||
| 148 | ||
| 149 | $result = null; |
|
| 150 | /** @var EntityInterface $entity */ |
|
| 151 | foreach ($this->identityMap as $entity) { |
|
| 152 | ||
| 153 | $data = $entity->extract(); |
|
| 154 | $isSatisfied = true; |
|
| 155 | ||
| 156 | foreach ($callbacks as $callback) { |
|
| 157 | if (!$callback($data)) { |
|
| 158 | $isSatisfied = false; |
|
| 159 | break 1; |
|
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| 163 | if ($isSatisfied) { |
|
| 164 | $result = $entity; |
|
| 165 | break; |
|
| 166 | } |
|
| 167 | } |
|
| 168 | ||
| 169 | if (is_null($result)) { |
|
| 170 | return; |
|
| @@ 207-222 (lines=16) @@ | ||
| 204 | $entities = new $this->collectionClass; |
|
| 205 | ||
| 206 | /** @var EntityInterface $entity */ |
|
| 207 | foreach ($this->identityMap as $entity) { |
|
| 208 | ||
| 209 | $data = $entity->extract(); |
|
| 210 | $isSatisfied = true; |
|
| 211 | ||
| 212 | foreach ($callbacks as $callback) { |
|
| 213 | if (!$callback($data)) { |
|
| 214 | $isSatisfied = false; |
|
| 215 | break 1; |
|
| 216 | } |
|
| 217 | } |
|
| 218 | ||
| 219 | if ($isSatisfied) { |
|
| 220 | $entities->offsetSet($entity->getId(), $entity); |
|
| 221 | } |
|
| 222 | } |
|
| 223 | ||
| 224 | foreach ($entities as $entity) { |
|
| 225 | $this->toIdentityMap($entity); |
|