ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ComponentDecoratorTrait.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\GlobalScreen\Scope;
22 
23 use Closure;
27 
32 {
33  use CheckClosureTrait;
34 
38 
39  private array $topics = [];
40 
41  public function withTopics(Topic ...$topics): self
42  {
43  $this->topics = $topics;
44 
45  return $this;
46  }
47 
48  public function getTopics(): array
49  {
50  return $this->topics;
51  }
52 
53  public function addComponentDecorator(Closure $component_decorator): self
54  {
55  $this->checkClosureForSignature($component_decorator, Component::class);
56 
57  if ($this->component_decorator instanceof Closure) {
58  $existing = $this->component_decorator;
59  $this->component_decorator = static function (Component $c) use (
60  $component_decorator,
61  $existing
62  ): Component {
63  $component = $existing($c);
64 
65  return $component_decorator($component);
66  };
67  } else {
68  $this->component_decorator = $component_decorator;
69  }
70 
71  return $this;
72  }
73 
74  public function getComponentDecorator(): ?Closure
75  {
77  }
78 
79  public function addSymbolDecorator(Closure $symbol_decorator): isDecorateable
80  {
81  $this->checkClosureForSignature($symbol_decorator, Symbol::class);
82 
83  if ($this->symbol_decorator instanceof Closure) {
84  $existing = $this->symbol_decorator;
85  $this->symbol_decorator = static function (Symbol $c) use ($symbol_decorator, $existing): Symbol {
86  $component = $existing($c);
87 
88  return $symbol_decorator($component);
89  };
90  } else {
91  $this->symbol_decorator = $symbol_decorator;
92  }
93 
94  return $this;
95  }
96 
97  public function getSymbolDecorator(): ?Closure
98  {
100  }
101 }
This describes a symbol.
Definition: Symbol.php:29
This is just a class that marks a string as a help topic.
Definition: Topic.php:26
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: deliver.php:25
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addSymbolDecorator(Closure $symbol_decorator)
addComponentDecorator(Closure $component_decorator)