ILIAS  release_8 Revision v8.24
ILIAS\GlobalScreen\Scope Namespace Reference

Namespaces

namespace  Layout
 @noinspection PhpIncompatibleReturnTypeInspection
 
namespace  Notification
 @noinspection PhpIncompatibleReturnTypeInspection
 
namespace  Toast
 
namespace  Tool
 @noinspection PhpIncompatibleReturnTypeInspection
 

Data Structures

interface  RenderFactory
 

Functions

 addComponentDecorator (Closure $component_decorator)
 
 getComponentDecorator ()
 
 checkClosure (Closure $c)
 
 addSymbolDecorator (Closure $symbol_decorator)
 
 getSymbolDecorator ()
 

Variables

trait ComponentDecoratorTrait
 
trait SymbolDecoratorTrait
 

Function Documentation

◆ addComponentDecorator()

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

Definition at line 44 of file ComponentDecoratorTrait.php.

45 {
46 if (!$this->checkClosure($component_decorator)) {
47 throw new LogicException('first argument and return value of closure must be type-hinted to \ILIAS\UI\Component\Component');
48 }
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);
53
54 return $component_decorator($component);
55 };
56 } else {
57 $this->component_decorator = $component_decorator;
58 }
59
60 return $this;
61 }
$c
Definition: cli.php:38
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

◆ addSymbolDecorator()

ILIAS\GlobalScreen\Scope\addSymbolDecorator ( Closure  $symbol_decorator)
Parameters
Closure$symbol_decorator
Returns
isGlobalScreenItem

Definition at line 45 of file SymbolDecoratorTrait.php.

46 {
47 if (!$this->checkClosure($symbol_decorator)) {
48 throw new LogicException('first argument and return type of closure must be type-hinted to \ILIAS\UI\Component\Symbol\Symbol');
49 }
50 if ($this->symbol_decorator instanceof Closure) {
51 $existing = $this->symbol_decorator;
52 $this->symbol_decorator = static function (Symbol $c) use ($symbol_decorator, $existing): Symbol {
53 $component = $existing($c);
54
55 return $symbol_decorator($component);
56 };
57 } else {
58 $this->symbol_decorator = $symbol_decorator;
59 }
60
61 return $this;
62 }

References $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 71 of file ComponentDecoratorTrait.php.

71 : bool
72 {
73 try {
74 $r = new ReflectionFunction($c);
75 if (count($r->getParameters()) !== 1) {
76 return false;
77 }
78 $first_param_type = $r->getParameters()[0]->getType();
79 if ($first_param_type instanceof ReflectionType && $first_param_type->getName() !== Component::class) {
80 return false;
81 }
82 $return_type = $r->getReturnType();
83 if ($return_type === null) {
84 return false;
85 }
86 if ($return_type->getName() !== Component::class) {
87 return false;
88 }
89
90 return true;
91 } catch (Throwable $i) {
92 return false;
93 }
94 }
$i
Definition: metadata.php:41

References $c, and $i.

Referenced by ILIAS\GlobalScreen\Scope\addComponentDecorator(), and ILIAS\GlobalScreen\Scope\addSymbolDecorator().

+ Here is the caller graph for this function:

◆ getComponentDecorator()

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

Definition at line 66 of file ComponentDecoratorTrait.php.

66 : ?Closure
67 {
68 return $this->component_decorator;
69 }

◆ getSymbolDecorator()

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

Definition at line 67 of file SymbolDecoratorTrait.php.

67 : ?Closure
68 {
69 return $this->symbol_decorator;
70 }

Variable Documentation

◆ ComponentDecoratorTrait

trait ILIAS::GlobalScreen::Scope\ComponentDecoratorTrait
Initial value:
{
private ?Closure $component_decorator = null

Definition at line 36 of file ComponentDecoratorTrait.php.

◆ SymbolDecoratorTrait

trait ILIAS::GlobalScreen::Scope\SymbolDecoratorTrait
Initial value:
{
private ?Closure $symbol_decorator = null

Definition at line 37 of file SymbolDecoratorTrait.php.