1 | <?php |
||
16 | class Resource extends IteratorIterator implements Collection, Hydrator |
||
17 | { |
||
18 | use NamedConstructorsTrait; |
||
19 | use ObjectStorageTrait; |
||
20 | use ImmutableCollectionTrait; |
||
21 | use ClosedOuterIteratorTrait; |
||
22 | use OuterIteratorTrait; |
||
23 | use ThrowImmutable { |
||
24 | ThrowImmutable::throwImmutable insteadof ImmutableCollectionTrait; |
||
25 | } |
||
26 | |||
27 | public function hydrate(stdClass $dto) |
||
28 | { |
||
29 | if (isset($dto->type)) { |
||
30 | foreach ($this->getStorage() as $hydrator) { |
||
31 | if ($hydrator->supports($dto->type)) { |
||
32 | return $hydrator->hydrate($dto); |
||
33 | } |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | |||
38 | public function supports($token) |
||
42 | |||
43 | protected function append(Hydrator $hydrator) |
||
47 | } |
||
48 |