ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Navigator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
28{
29 public function __construct(
31 ElementInterface $start_element,
33 ) {
34 parent::__construct($path, $start_element, $bridge);
35 }
36
37 public function nextStep(): ?NavigatorInterface
38 {
39 $return = parent::nextStep();
40 if (($return instanceof NavigatorInterface) || is_null($return)) {
41 return $return;
42 }
43 throw new \ilMDPathException('Invalid Navigator');
44 }
45
46 public function previousStep(): ?NavigatorInterface
47 {
48 $return = parent::previousStep();
49 if (($return instanceof NavigatorInterface) || is_null($return)) {
50 return $return;
51 }
52 throw new \ilMDPathException('Invalid Navigator');
53 }
54
59 public function elementsAtFinalStep(): \Generator
60 {
61 foreach (parent::elementsAtFinalStep() as $element) {
62 if (!($element instanceof ElementInterface)) {
63 throw new \ilMDElementsException(
64 'Invalid Navigator.'
65 );
66 }
67 yield $element;
68 }
69 }
70
75 {
76 $element = parent::lastElementAtFinalStep();
77 if (($element instanceof ElementInterface) || is_null($element)) {
78 return $element;
79 }
80 throw new \ilMDPathException(
81 'Invalid Navigator.'
82 );
83 }
84
89 public function elements(): \Generator
90 {
91 foreach (parent::elements() as $element) {
92 if (!($element instanceof ElementInterface)) {
93 throw new \ilMDPathException(
94 'Invalid Navigator.'
95 );
96 }
97 yield $element;
98 }
99 }
100
101
105 public function lastElement(): ?ElementInterface
106 {
107 $element = parent::lastElement();
108 if (($element instanceof ElementInterface) || is_null($element)) {
109 return $element;
110 }
111 throw new \ilMDPathException(
112 'Invalid Navigator.'
113 );
114 }
115}
__construct(PathInterface $path, ElementInterface $start_element, NavigatorBridge $bridge)
Definition: Navigator.php:29
nextStep()
Returns null if there is no next step.
Definition: Navigator.php:37
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc