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

Namespaces

 Layout
 PhpIncompatibleReturnTypeInspection
 
 MainMenu
 
 MetaBar
 
 Notification
 PhpIncompatibleReturnTypeInspection
 
 Toast
 
 Tool
 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.

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

44  : isGlobalScreenItem
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...
+ 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.

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

45  : isGlobalScreenItem
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  }
$c
Definition: cli.php:38
+ Here is the call graph for this function:

◆ checkClosure()

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

Definition at line 71 of file ComponentDecoratorTrait.php.

References $i.

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

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  }
$c
Definition: cli.php:38
$i
Definition: metadata.php:41
+ 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.

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

67  : ?Closure
68  {
69  return $this->symbol_decorator;
70  }
+ Here is the call graph for this function:

Variable Documentation

◆ ComponentDecoratorTrait

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

Definition at line 37 of file ComponentDecoratorTrait.php.

◆ SymbolDecoratorTrait

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

Definition at line 38 of file SymbolDecoratorTrait.php.