ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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
 
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.

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

41  {
42  $this->is_relative = $is_relative;
43  $this->leads_to_one = $leads_to_one;
44  $this->steps = $steps;
45  }
+ 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.

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

108  : string
109  {
110  return $this->toString();
111  }
+ 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.

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

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

55  : bool
56  {
57  return $this->is_relative;
58  }
+ 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.

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

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

60  : bool
61  {
62  return $this->leads_to_one;
63  }
+ 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.

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

50  : \Generator
51  {
52  yield from $this->steps;
53  }
+ 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.

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

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

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

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  }
leadsToExactlyOneElement()
Specifies whether the path should point to exactly one element, or whether it can also lead to no or ...
Definition: Path.php:60
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
+ 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: