3 declare(strict_types=1);
53 if (empty($target_classes)) {
54 throw new ilCtrlException(__METHOD__ .
" must be provided with a list of classes.");
61 foreach ($target_classes as $current_class) {
62 $current_cid = $this->structure->getClassCidByName($current_class);
65 if (null === $current_cid) {
66 throw new ilCtrlException(
"Class '$current_class' was not found in the control structure, try `composer du` to read artifacts.");
71 if (null !== $previous_class && !$this->
isClassParentOf($previous_class, $current_class)) {
72 throw new ilCtrlException(
"Class '$current_class' is not a child of '$previous_class'.");
76 $previous_class = $current_class;
81 $first_array_class = $target_classes[array_key_first($target_classes)];
82 if ($this->structure->isBaseClass($first_array_class)) {
89 if (null === $related_class_path) {
90 throw new ilCtrlException(
"Class '$first_array_class' is not a baseclass and the current context doesn't have one either.");
ilCtrlException $exception
Class ilCtrlArrayClassPath.
Class ilCtrlAbstractPath.
isClassParentOf(string $parent_class, string $child_class)
Returns whether the given target class is a parent of the other given class.
getPathToRelatedClassInContext(ilCtrlContextInterface $context, string $target_class)
Returns the path to a class within the given contexts current path that has a relation to the given t...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilCtrlStructureInterface $structure, ilCtrlContextInterface $context, array $target_classes)
ilCtrlArrayClassPath Constructor
appendCid(string $cid, string $path=null)
Helper function to add CIDs to a given path.
__construct(Container $dic, ilPlugin $plugin)
ilCtrlContextInterface $context
getCidPathByArray(array $target_classes)
Generates a cid path from the given class array.
ilCtrlStructureInterface $structure