ILIAS  release_7 Revision v7.30-3-g800a261c036
TreeTool.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30use 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
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}
An exception for terminatinating execution or to throw for unit testing.
withSymbol(Symbol $symbol)
@inheritDoc
Definition: TreeTool.php:76
Interface hasSymbol Methods for Entries with Symbols.
Definition: hasSymbol.php:33
This describes how a glyph could be modified during construction of UI.
Definition: Glyph.php:14
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:10
This describes a symbol.
Definition: Symbol.php:12
This describes a Tree Control.
Definition: Tree.php:14