ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Paths\Path Class Reference
+ Inheritance diagram for ILIAS\MetaData\Paths\Path:
+ Collaboration diagram for ILIAS\MetaData\Paths\Path:

Public Member Functions

 __construct (bool $is_relative, bool $leads_to_one, StepInterface ... $steps)
 
 steps ()
 
 isRelative ()
 Relative paths start at some otherwise determined element, absolute paths start at root. More...
 
 leadsToExactlyOneElement ()
 Specifies whether the path should point to exactly one element, or whether it can also lead to no or many elements. More...
 
 toString ()
 
 __toString ()
 
 steps ()
 Get all steps in the path. More...
 
 isRelative ()
 Relative paths start at some otherwise determined element, absolute paths start at root. More...
 
 leadsToExactlyOneElement ()
 Specifies whether the path should point to exactly one element, or whether it can also lead to no or many elements. More...
 
 toString ()
 

Protected Member Functions

 stepToString (StepInterface $step)
 

Protected Attributes

array $steps
 
bool $is_relative
 
bool $leads_to_one
 
string $as_string
 

Detailed Description

Definition at line 26 of file Path.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Paths\Path::__construct ( bool  $is_relative,
bool  $leads_to_one,
StepInterface ...  $steps 
)

Definition at line 37 of file Path.php.

41 {
42 $this->is_relative = $is_relative;
43 $this->leads_to_one = $leads_to_one;
44 $this->steps = $steps;
45 }

References ILIAS\MetaData\Paths\Path\$is_relative, ILIAS\MetaData\Paths\Path\$leads_to_one, ILIAS\MetaData\Paths\Path\$steps, and ILIAS\MetaData\Paths\Path\steps().

+ Here is the call graph for this function:

Member Function Documentation

◆ __toString()

ILIAS\MetaData\Paths\Path::__toString ( )

Definition at line 108 of file Path.php.

108 : string
109 {
110 return $this->toString();
111 }

References ILIAS\MetaData\Paths\Path\toString().

+ Here is the call graph for this function:

◆ isRelative()

ILIAS\MetaData\Paths\Path::isRelative ( )

Relative paths start at some otherwise determined element, absolute paths start at root.

Implements ILIAS\MetaData\Paths\PathInterface.

Definition at line 55 of file Path.php.

55 : bool
56 {
57 return $this->is_relative;
58 }

References ILIAS\MetaData\Paths\Path\$is_relative.

Referenced by ILIAS\MetaData\Paths\Path\toString().

+ Here is the caller graph for this function:

◆ leadsToExactlyOneElement()

ILIAS\MetaData\Paths\Path::leadsToExactlyOneElement ( )

Specifies whether the path should point to exactly one element, or whether it can also lead to no or many elements.

Implements ILIAS\MetaData\Paths\PathInterface.

Definition at line 60 of file Path.php.

60 : bool
61 {
63 }

References ILIAS\MetaData\Paths\Path\$leads_to_one.

Referenced by ILIAS\MetaData\Paths\Path\toString().

+ Here is the caller graph for this function:

◆ steps()

ILIAS\MetaData\Paths\Path::steps ( )
Returns
StepInterface[]

Implements ILIAS\MetaData\Paths\PathInterface.

Definition at line 50 of file Path.php.

50 : \Generator
51 {
52 yield from $this->steps;
53 }

References ILIAS\MetaData\Paths\Path\$steps, and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\from().

Referenced by ILIAS\MetaData\Paths\Path\__construct(), and ILIAS\MetaData\Paths\Path\toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stepToString()

ILIAS\MetaData\Paths\Path::stepToString ( StepInterface  $step)
protected

Definition at line 89 of file Path.php.

89 : string
90 {
91 $string = $step->name();
92 if ($string instanceof StepToken) {
93 $string = $string->value;
94 }
95 foreach ($step->filters() as $filter) {
96 $string .= Token::FILTER_SEPARATOR->value .
97 $filter->type()->value .
99
100 $string .= implode(
102 iterator_to_array($filter->values())
103 );
104 }
105 return $string;
106 }
name()
Steps are identified by the names of LOM elements, or a token to specify a step to the super-element.
filters()
Filters restrict the elements a step leads to.
StepToken
The string representation of these tokens must not occur as names of metadata elements.
Definition: StepToken.php:28

References ILIAS\MetaData\Paths\FILTER_VALUE_SEPARATOR, ILIAS\MetaData\Paths\Steps\StepInterface\filters(), and ILIAS\MetaData\Paths\Steps\StepInterface\name().

Referenced by ILIAS\MetaData\Paths\Path\toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toString()

ILIAS\MetaData\Paths\Path::toString ( )

Implements ILIAS\MetaData\Paths\PathInterface.

Definition at line 65 of file Path.php.

65 : string
66 {
67 if (isset($this->as_string)) {
68 return $this->as_string;
69 }
70
71 $string = '';
72
73 if ($this->leadsToExactlyOneElement()) {
74 $string .= Token::LEADS_TO_EXACTLY_ONE->value;
75 }
76 if ($this->isRelative()) {
77 $string .= Token::START_AT_CURRENT->value;
78 } else {
79 $string .= Token::START_AT_ROOT->value;
80 }
81 foreach ($this->steps() as $step) {
82 $string .= Token::SEPARATOR->value;
83 $string .= $this->stepToString($step);
84 }
85
86 return $this->as_string = $string;
87 }
isRelative()
Relative paths start at some otherwise determined element, absolute paths start at root.
Definition: Path.php:55
stepToString(StepInterface $step)
Definition: Path.php:89
leadsToExactlyOneElement()
Specifies whether the path should point to exactly one element, or whether it can also lead to no or ...
Definition: Path.php:60

References ILIAS\MetaData\Paths\Path\$as_string, ILIAS\MetaData\Paths\Path\isRelative(), ILIAS\MetaData\Paths\Path\leadsToExactlyOneElement(), ILIAS\MetaData\Paths\Path\steps(), and ILIAS\MetaData\Paths\Path\stepToString().

Referenced by ILIAS\MetaData\Paths\Path\__toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $as_string

string ILIAS\MetaData\Paths\Path::$as_string
protected

Definition at line 35 of file Path.php.

Referenced by ILIAS\MetaData\Paths\Path\toString().

◆ $is_relative

bool ILIAS\MetaData\Paths\Path::$is_relative
protected

◆ $leads_to_one

bool ILIAS\MetaData\Paths\Path::$leads_to_one
protected

◆ $steps

array ILIAS\MetaData\Paths\Path::$steps
protected

The documentation for this class was generated from the following file: