ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 

Protected Member Functions

 stepToString (StepInterface $step)
 

Protected Attributes

array $steps
 
bool $is_relative
 
bool $leads_to_one
 

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 35 of file Path.php.

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().

39  {
40  $this->is_relative = $is_relative;
41  $this->leads_to_one = $leads_to_one;
42  $this->steps = $steps;
43  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __toString()

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

Definition at line 102 of file Path.php.

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

102  : string
103  {
104  return $this->toString();
105  }
+ 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 53 of file Path.php.

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

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

53  : bool
54  {
55  return $this->is_relative;
56  }
+ 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 58 of file Path.php.

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

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

58  : bool
59  {
60  return $this->leads_to_one;
61  }
+ Here is the caller graph for this function:

◆ steps()

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

Implements ILIAS\MetaData\Paths\PathInterface.

Definition at line 48 of file Path.php.

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().

48  : \Generator
49  {
50  yield from $this->steps;
51  }
+ 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 83 of file Path.php.

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().

83  : string
84  {
85  $string = $step->name();
86  if ($string instanceof StepToken) {
87  $string = $string->value;
88  }
89  foreach ($step->filters() as $filter) {
90  $string .= Token::FILTER_SEPARATOR->value .
91  $filter->type()->value .
93 
94  $string .= implode(
96  iterator_to_array($filter->values())
97  );
98  }
99  return $string;
100  }
StepToken
The string representation of these tokens must not occur as names of metadata elements.
Definition: StepToken.php:27
+ 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 63 of file Path.php.

References 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().

63  : string
64  {
65  $string = '';
66 
67  if ($this->leadsToExactlyOneElement()) {
68  $string .= Token::LEADS_TO_EXACTLY_ONE->value;
69  }
70  if ($this->isRelative()) {
71  $string .= Token::START_AT_CURRENT->value;
72  } else {
73  $string .= Token::START_AT_ROOT->value;
74  }
75  foreach ($this->steps() as $step) {
76  $string .= Token::SEPARATOR->value;
77  $string .= $this->stepToString($step);
78  }
79 
80  return $string;
81  }
leadsToExactlyOneElement()
Specifies whether the path should point to exactly one element, or whether it can also lead to no or ...
Definition: Path.php:58
isRelative()
Relative paths start at some otherwise determined element, absolute paths start at root...
Definition: Path.php:53
stepToString(StepInterface $step)
Definition: Path.php:83
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $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: