19 declare(strict_types=1);
40 $exploded = explode(Token::SEPARATOR->value, strtolower($string));
42 $exploded = array_slice($exploded, 1);
43 foreach ($exploded as $step_string) {
46 return $builder->get();
53 $pattern =
'/^(' . strtolower(Token::LEADS_TO_EXACTLY_ONE->value) .
54 ')?(' . strtolower(Token::START_AT_ROOT->value) .
'|' .
55 strtolower(Token::START_AT_CURRENT->value) .
')$/';
56 if (!preg_match($pattern, $string, $matches)) {
57 throw new \ilMDPathException(
58 'Cannot create path, invalid modes in input string: ' . $string
61 if (!empty($matches[1])) {
64 if ($matches[2] === Token::START_AT_ROOT->value) {
76 $exploded = explode(Token::FILTER_SEPARATOR->value, strtolower($string));
77 $name = StepToken::tryFrom($exploded[0]) ?? $exploded[0];
83 $exploded = array_slice($exploded, 1);
84 foreach ($exploded as $filter_string) {
85 $exploded_filter = explode(
87 strtolower($filter_string)
89 $type = FilterType::tryFrom($exploded_filter[0]);
90 $exploded_filter = array_slice($exploded_filter, 1);
91 if (!is_null($type)) {
98 throw new \ilMDPathException(
99 'Cannot create path, invalid filter type.' 107 bool $leads_to_exactly_one =
false 111 ->withRelative(
false)
112 ->withLeadsToExactlyOneElement($leads_to_exactly_one);
118 $leads_to_exactly_one,
123 throw new \ilMDPathException(
124 'Cannot build path from element without root.' 129 return $builder->get();
135 bool $leads_to_exactly_one =
false 139 array_unshift($to_and_supers, $to);
146 ->withLeadsToExactlyOneElement($leads_to_exactly_one);
148 while (!in_array($from, $to_and_supers,
true)) {
149 $builder = $builder->withNextStepToSuperElement();
152 throw new \ilMDPathException(
153 'Cannot build path between elements from disjunct sets.' 158 $to_and_supers = array_slice(
160 array_search($from, $to_and_supers,
true) + 1
162 foreach ($to_and_supers as $element) {
166 $leads_to_exactly_one,
171 return $builder->get();
177 bool $leads_to_exactly_one,
190 if ($leads_to_exactly_one) {
202 return new Builder($this->structure);
if(!file_exists('../ilias.ini.php'))
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins