ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
Icon.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
5 
6 use ILIAS\UI\Component as C;
9 
10 abstract class Icon implements C\Symbol\Icon\Icon
11 {
12  use ComponentHelper;
14 
18  protected $name;
19 
23  protected $aria_label;
24 
28  protected $size;
29 
33  protected $abbreviation;
34 
38  protected $is_disabled;
39 
43  protected static $possible_sizes = array(
44  self::SMALL,
45  self::MEDIUM,
46  self::LARGE,
47  self::RESPONSIVE
48  );
49 
50 
54  public function getName()
55  {
56  return $this->name;
57  }
58 
62  public function getAriaLabel()
63  {
64  return $this->aria_label;
65  }
66 
71  {
72  $this->checkStringArg("string", $abbreviation);
73  $clone = clone $this;
74  $clone->abbreviation = $abbreviation;
75  return $clone;
76  }
77 
81  public function getAbbreviation()
82  {
83  return $this->abbreviation;
84  }
85 
89  public function withSize($size)
90  {
91  $this->checkArgIsElement(
92  "size",
93  $size,
94  self::$possible_sizes,
95  implode('/', self::$possible_sizes)
96  );
97  $clone = clone $this;
98  $clone->size = $size;
99  return $clone;
100  }
101 
105  public function getSize()
106  {
107  return $this->size;
108  }
109 
113  public function isDisabled()
114  {
115  return $this->is_disabled;
116  }
117 
121  public function withDisabled($is_disabled)
122  {
123  $this->checkBoolArg("is_disabled", $is_disabled);
124  $clone = clone $this;
125  $clone->is_disabled = $is_disabled;
126  return $clone;
127  }
128 }
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
trait ComponentHelper
Provides common functionality for component implementations.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
checkBoolArg($which, $value)
Throw an InvalidArgumentException if $value is not a bool.