ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\GlobalScreen\Scope Namespace Reference

Namespaces

 Layout
 PhpIncompatibleReturnTypeInspection
 
 MainMenu
 
 MetaBar
 
 Notification
 PhpIncompatibleReturnTypeInspection
 
 Tool
 PhpIncompatibleReturnTypeInspection
 

Data Structures

interface  isGlobalScreenItem
 Interface isGlobalScreenItem. More...
 
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 47 of file ComponentDecoratorTrait.php.

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

47  : isGlobalScreenItem
48  {
49  if (!$this->checkClosure($component_decorator)) {
50  throw new LogicException('first argument and return value of closure must be type-hinted to \ILIAS\UI\Component\Component');
51  }
52  if ($this->component_decorator instanceof Closure) {
53  $existing = $this->component_decorator;
54  $this->component_decorator = static function (Component $c) use ($component_decorator, $existing) : Component {
55  $component = $existing($c);
56 
57  return $component_decorator($component);
58  };
59  } else {
60  $this->component_decorator = $component_decorator;
61  }
62 
63  return $this;
64  }
$c
Definition: cli.php:37
+ 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 47 of file SymbolDecoratorTrait.php.

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

47  : isGlobalScreenItem
48  {
49  if (!$this->checkClosure($symbol_decorator)) {
50  throw new LogicException('first argument and return type of closure must be type-hinted to \ILIAS\UI\Component\Symbol\Symbol');
51  }
52  if ($this->symbol_decorator instanceof Closure) {
53  $existing = $this->symbol_decorator;
54  $this->symbol_decorator = static function (Symbol $c) use ($symbol_decorator, $existing) : Symbol {
55  $component = $existing($c);
56 
57  return $symbol_decorator($component);
58  };
59  } else {
60  $this->symbol_decorator = $symbol_decorator;
61  }
62 
63  return $this;
64  }
$c
Definition: cli.php:37
+ Here is the call graph for this function:

◆ checkClosure()

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

Definition at line 74 of file ComponentDecoratorTrait.php.

References $i.

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

74  : bool
75  {
76  try {
77  $r = new ReflectionFunction($c);
78  if (count($r->getParameters()) !== 1) {
79  return false;
80  }
81  $first_param_type = $r->getParameters()[0]->getType();
82  if ($first_param_type instanceof ReflectionType && $first_param_type->getName() !== Component::class) {
83  return false;
84  }
85  $return_type = $r->getReturnType();
86  if ($return_type === null) {
87  return false;
88  }
89  if ($return_type->getName() !== Component::class) {
90  return false;
91  }
92 
93  return true;
94  } catch (Throwable $i) {
95  return false;
96  }
97  }
$c
Definition: cli.php:37
$i
Definition: metadata.php:24
+ Here is the caller graph for this function:

◆ getComponentDecorator()

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

Definition at line 69 of file ComponentDecoratorTrait.php.

69  : ?Closure
70  {
71  return $this->component_decorator;
72  }

◆ getSymbolDecorator()

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

Definition at line 69 of file SymbolDecoratorTrait.php.

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

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

Variable Documentation

◆ ComponentDecoratorTrait

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

Definition at line 37 of file ComponentDecoratorTrait.php.

◆ SymbolDecoratorTrait

trait ILIAS::GlobalScreen::Scope\SymbolDecoratorTrait
Initial value:
{
private $symbol_decorator

Definition at line 37 of file SymbolDecoratorTrait.php.