ILIAS  release_7 Revision v7.30-3-g800a261c036
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
9
10abstract class Icon implements C\Symbol\Icon\Icon
11{
14
18 protected $name;
19
23 protected $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 getLabel()
63 {
64 return $this->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 {
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}
An exception for terminatinating execution or to throw for unit testing.
checkStringArg($which, $value)
Throw an InvalidArgumentException if $value is no string.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
checkBoolArg($which, $value)
Throw an InvalidArgumentException if $value is not a bool.
trait ComponentHelper
Provides common functionality for component implementations.
checkArgIsElement($which, $value, $array, $name)
Throw an InvalidArgumentException if $value is not an element of array.