1<?
php declare(strict_types=1);
24 private $component_decorator;
35 throw new LogicException(
'first argument and return value of closure must be type-hinted to \ILIAS\UI\Component\Component');
37 if ($this->component_decorator instanceof Closure) {
38 $existing = $this->component_decorator;
39 $this->component_decorator =
static function (
Component $c) use ($component_decorator, $existing) :
Component {
40 $component = $existing(
$c);
42 return $component_decorator($component);
45 $this->component_decorator = $component_decorator;
57 return $this->component_decorator;
64 $r =
new ReflectionFunction(
$c);
65 if (count($r->getParameters()) !== 1) {
68 $first_param_type = $r->getParameters()[0]->getType();
69 if ($first_param_type instanceof ReflectionType && $first_param_type->getName() !== Component::class) {
72 $return_type = $r->getReturnType();
73 if ($return_type ===
null) {
76 if ($return_type->getName() !== Component::class) {
81 }
catch (\Throwable
$i) {
An exception for terminatinating execution or to throw for unit testing.
Interface isGlobalScreenItem.
A component is the most general form of an entity in the UI.
trait ComponentDecoratorTrait
addComponentDecorator(Closure $component_decorator)