ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StructureNavigator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
28{
29 public function __construct(
31 StructureElementInterface $start_element,
33 ) {
34 parent::__construct($path, $start_element, $bridge);
35 $this->leadsToOne(true);
36 }
37
39 {
40 $return = parent::nextStep();
41 if (($return instanceof StructureNavigatorInterface) || is_null($return)) {
42 return $return;
43 }
44 throw new \ilMDPathException('Invalid Navigator');
45 }
46
48 {
49 $return = parent::previousStep();
50 if (($return instanceof StructureNavigatorInterface) || is_null($return)) {
51 return $return;
52 }
53 throw new \ilMDPathException('Invalid Navigator');
54 }
55
57 {
58 $element = parent::elementsAtFinalStep()->current();
59 if (!($element instanceof StructureElementInterface)) {
60 throw new \ilMDPathException(
61 'Invalid Navigator.'
62 );
63 }
64 return $element;
65 }
66
68 {
69 $element = parent::elements()->current();
70 if (!($element instanceof StructureElementInterface)) {
71 throw new \ilMDPathException(
72 'Invalid Navigator.'
73 );
74 }
75 return $element;
76 }
77}
elementAtFinalStep()
Returns the element at the end of the path.
nextStep()
Returns null if there is no next step.
__construct(PathInterface $path, StructureElementInterface $start_element, NavigatorBridge $bridge)
element()
Returns the element at the current step in the path.
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc