ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ILIAS\GlobalScreen\Scope Namespace Reference

Namespaces

namespace  Layout
 
namespace  Notification
 
namespace  Tool
 

Data Structures

interface  isGlobalScreenItem
 Interface isGlobalScreenItem. More...
 

Functions

 addComponentDecorator (Closure $component_decorator)
 
 getComponentDecorator ()
 
 checkClosure (Closure $c)
 

Variables

trait ComponentDecoratorTrait
 

Function Documentation

◆ addComponentDecorator()

ILIAS\GlobalScreen\Scope\addComponentDecorator ( Closure  $component_decorator)
Parameters
Closure$component_decorator
Returns
isGlobalScreenItem

Definition at line 32 of file ComponentDecoratorTrait.php.

33 {
34 if (!$this->checkClosure($component_decorator)) {
35 throw new LogicException('first argument and return value of closure must be type-hinted to \ILIAS\UI\Component\Component');
36 }
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);
41
42 return $component_decorator($component);
43 };
44 } else {
45 $this->component_decorator = $component_decorator;
46 }
47
48 return $this;
49 }

References Vendor\Package\$c, and ILIAS\GlobalScreen\Scope\checkClosure().

+ Here is the call graph for this function:

◆ checkClosure()

ILIAS\GlobalScreen\Scope\checkClosure ( Closure  $c)
private

Definition at line 61 of file ComponentDecoratorTrait.php.

61 : bool
62 {
63 try {
64 $r = new ReflectionFunction($c);
65 if (count($r->getParameters()) !== 1) {
66 return false;
67 }
68 $first_param_type = $r->getParameters()[0]->getType();
69 if ($first_param_type instanceof ReflectionType && $first_param_type->getName() !== Component::class) {
70 return false;
71 }
72 $return_type = $r->getReturnType();
73 if ($return_type === null) {
74 return false;
75 }
76 if ($return_type->getName() !== Component::class) {
77 return false;
78 }
79
80 return true;
81 } catch (\Throwable $i) {
82 return false;
83 }
84 }
$i
Definition: metadata.php:24

References Vendor\Package\$c, and $i.

Referenced by ILIAS\GlobalScreen\Scope\addComponentDecorator().

+ Here is the caller graph for this function:

◆ getComponentDecorator()

ILIAS\GlobalScreen\Scope\getComponentDecorator ( )
Returns
Closure|null

Definition at line 55 of file ComponentDecoratorTrait.php.

55 : ?Closure
56 {
57 return $this->component_decorator;
58 }

Variable Documentation

◆ ComponentDecoratorTrait

trait ILIAS::GlobalScreen::Scope\ComponentDecoratorTrait
Initial value:
{
private $component_decorator

Definition at line 18 of file ComponentDecoratorTrait.php.