ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
TreeTool.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 use LogicException;
31 
37 {
39 
43  protected $symbol;
47  protected $tree;
51  protected $title;
52 
57  public function withTitle(string $title) : hasTitle
58  {
59  $clone = clone($this);
60  $clone->title = $title;
61 
62  return $clone;
63  }
64 
68  public function getTitle() : string
69  {
70  return $this->title;
71  }
72 
76  public function withSymbol(Symbol $symbol) : hasSymbol
77  {
78  // bugfix mantis 25526: make aria labels mandatory
79  if (($symbol instanceof Glyph\Glyph && $symbol->getAriaLabel() === "") ||
80  ($symbol instanceof Icon\Icon && $symbol->getLabel() === "")) {
81  throw new LogicException("the symbol's aria label MUST be set to ensure accessibility");
82  }
83 
84  $clone = clone($this);
85  $clone->symbol = $symbol;
86 
87  return $clone;
88  }
89 
93  public function withTree(Tree $tree) : self
94  {
95  $clone = clone($this);
96  $clone->tree = $tree;
97 
98  return $clone;
99  }
100 
104  public function getTree() : Tree
105  {
106  return $this->tree;
107  }
108 
112  public function getSymbol() : Symbol
113  {
114  return $this->symbol;
115  }
116 
120  public function hasSymbol() : bool
121  {
122  return ($this->symbol instanceof Symbol);
123  }
124 }
This describes a symbol.
Definition: Symbol.php:11
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:9
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:13
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:32
This describes a Tree Control.
Definition: Tree.php:13