ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Reader.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28
29class Reader implements ReaderInterface
30{
32 protected SetInterface $set;
33
34 public function __construct(
37 ) {
38 $this->navigator_factory = $navigator_factory;
39 $this->set = $set;
40 }
41
45 public function allData(PathInterface $path): \Generator
46 {
47 $navigator = $this->navigator_factory->navigator($path, $this->set->getRoot());
48 foreach ($navigator->elementsAtFinalStep() as $element) {
49 yield $element->getData();
50 }
51 }
52
54 {
55 $navigator = $this->navigator_factory->navigator($path, $this->set->getRoot());
56 if ($first = $navigator->elementsAtFinalStep()->current()) {
57 return $first->getData();
58 }
59 return new NullData();
60 }
61}
NavigatorFactoryInterface $navigator_factory
Definition: Reader.php:31
firstData(PathInterface $path)
Get the data of the first of the elements specified by the path.
Definition: Reader.php:53
allData(PathInterface $path)
Definition: Reader.php:45
__construct(NavigatorFactoryInterface $navigator_factory, SetInterface $set)
Definition: Reader.php:34
$path
Definition: ltiservices.php:30