19declare(strict_types=1);
26use ReflectionFunction;
38 private ?Closure $component_decorator =
null;
47 throw new LogicException(
'first argument and return value of closure must be type-hinted to \ILIAS\UI\Component\Component');
49 if ($this->component_decorator instanceof Closure) {
50 $existing = $this->component_decorator;
51 $this->component_decorator =
static function (
Component $c) use ($component_decorator, $existing):
Component {
52 $component = $existing(
$c);
54 return $component_decorator($component);
57 $this->component_decorator = $component_decorator;
68 return $this->component_decorator;
74 $r =
new ReflectionFunction(
$c);
75 if (count($r->getParameters()) !== 1) {
78 $first_param_type = $r->getParameters()[0]->getType();
79 if ($first_param_type instanceof ReflectionType && $first_param_type->getName() !== Component::class) {
82 $return_type = $r->getReturnType();
83 if ($return_type ===
null) {
86 if ($return_type->getName() !== Component::class) {
91 }
catch (Throwable
$i) {
Interface isGlobalScreenItem.
A component is the most general form of an entity in the UI.
trait ComponentDecoratorTrait
addComponentDecorator(Closure $component_decorator)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...