19 declare(strict_types=1);
46 $this->path_conditions = [];
47 $this->is_relative = $path_interface->
isRelative();
49 $this->buildPathConditionsDict($path_interface);
55 return $this->path_conditions[$name];
65 $this->leads_to_exactly_one_element
74 $builder = $this->path_factory->custom()
75 ->withRelative($is_relative)
76 ->withLeadsToExactlyOneElement($leads_to_exactly_one);
77 foreach ($steps as $step) {
78 $builder = $builder->withNextStepFromStep($step,
false);
80 return $builder->get();
90 $this->history[] = $step;
93 protected function buildPathConditionsDict(
PathInterface $path_interface):
void 98 foreach ($path_interface->
steps() as $step) {
101 $this->buildPathCondition();
108 return array_key_exists($name, $this->path_conditions);
111 protected function buildPathCondition():
void 122 $step_up = array_pop($this->history);
123 $step_condition = array_pop($this->history);
124 $target = $this->history[count($this->history) - 1];
125 $steps = [$step_condition, $step_up];
129 $nested_condition_path = $this->path_conditions[$step_condition->name()];
131 foreach ($nested_condition_path->steps() as $step) {
135 unset($this->path_conditions[$step_condition->name()]);
140 $existing_condition_path = $this->path_conditions[$target->name()];
141 $frontConditions = [];
142 foreach ($existing_condition_path->steps() as $step) {
143 $frontConditions[] = $step;
145 array_unshift($steps, ...$frontConditions);
146 unset($this->path_conditions[$target->name()]);