@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | */ |
26 | 26 | trait Traits_Classable |
27 | 27 | { |
28 | - /** |
|
29 | - * @var string[] |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @var string[] |
|
30 | + */ |
|
31 | 31 | protected $classes = array(); |
32 | 32 | |
33 | 33 | public function addClass(string $name) |
@@ -65,30 +65,30 @@ discard block |
||
65 | 65 | return $this; |
66 | 66 | } |
67 | 67 | |
68 | - /** |
|
69 | - * Retrieves a list of all classes, if any. |
|
70 | - * |
|
71 | - * @return string[] |
|
72 | - */ |
|
68 | + /** |
|
69 | + * Retrieves a list of all classes, if any. |
|
70 | + * |
|
71 | + * @return string[] |
|
72 | + */ |
|
73 | 73 | public function getClasses() : array |
74 | 74 | { |
75 | 75 | return $this->classes; |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Renders the class names list as space-separated string for use in an HTML tag. |
|
80 | - * |
|
81 | - * @return string |
|
82 | - */ |
|
78 | + /** |
|
79 | + * Renders the class names list as space-separated string for use in an HTML tag. |
|
80 | + * |
|
81 | + * @return string |
|
82 | + */ |
|
83 | 83 | public function classesToString() : string |
84 | 84 | { |
85 | 85 | return implode(' ', $this->classes); |
86 | 86 | } |
87 | 87 | |
88 | - /** |
|
89 | - * Renders the "class" attribute string for inserting into an HTML tag. |
|
90 | - * @return string |
|
91 | - */ |
|
88 | + /** |
|
89 | + * Renders the "class" attribute string for inserting into an HTML tag. |
|
90 | + * @return string |
|
91 | + */ |
|
92 | 92 | public function classesToAttribute() : string |
93 | 93 | { |
94 | 94 | if(!empty($this->classes)) |
@@ -117,42 +117,42 @@ discard block |
||
117 | 117 | */ |
118 | 118 | interface Interface_Classable |
119 | 119 | { |
120 | - /** |
|
121 | - * @param string $name |
|
122 | - * @return $this |
|
123 | - */ |
|
120 | + /** |
|
121 | + * @param string $name |
|
122 | + * @return $this |
|
123 | + */ |
|
124 | 124 | public function addClass(string $name); |
125 | 125 | |
126 | - /** |
|
127 | - * @param array $names |
|
128 | - * @return $this |
|
129 | - */ |
|
126 | + /** |
|
127 | + * @param array $names |
|
128 | + * @return $this |
|
129 | + */ |
|
130 | 130 | public function addClasses(array $names); |
131 | 131 | |
132 | - /** |
|
133 | - * @param string $name |
|
134 | - * @return bool |
|
135 | - */ |
|
132 | + /** |
|
133 | + * @param string $name |
|
134 | + * @return bool |
|
135 | + */ |
|
136 | 136 | public function hasClass(string $name) : bool; |
137 | 137 | |
138 | - /** |
|
139 | - * @param string $name |
|
140 | - * @return $this |
|
141 | - */ |
|
138 | + /** |
|
139 | + * @param string $name |
|
140 | + * @return $this |
|
141 | + */ |
|
142 | 142 | public function removeClass(string $name); |
143 | 143 | |
144 | - /** |
|
145 | - * @return array |
|
146 | - */ |
|
144 | + /** |
|
145 | + * @return array |
|
146 | + */ |
|
147 | 147 | public function getClasses() : array; |
148 | 148 | |
149 | - /** |
|
150 | - * @return string |
|
151 | - */ |
|
149 | + /** |
|
150 | + * @return string |
|
151 | + */ |
|
152 | 152 | public function classesToString() : string; |
153 | 153 | |
154 | - /** |
|
155 | - * @return string |
|
156 | - */ |
|
154 | + /** |
|
155 | + * @return string |
|
156 | + */ |
|
157 | 157 | public function classesToAttribute() : string; |
158 | 158 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function addClass(string $name) |
34 | 34 | { |
35 | - if(!in_array($name, $this->classes)) { |
|
35 | + if (!in_array($name, $this->classes)) { |
|
36 | 36 | $this->classes[] = $name; |
37 | 37 | } |
38 | 38 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function addClasses(array $names) |
43 | 43 | { |
44 | - foreach($names as $name) { |
|
44 | + foreach ($names as $name) { |
|
45 | 45 | $this->addClass($name); |
46 | 46 | } |
47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $idx = array_search($name, $this->classes); |
59 | 59 | |
60 | - if($idx !== false) { |
|
60 | + if ($idx !== false) { |
|
61 | 61 | unset($this->classes[$idx]); |
62 | 62 | sort($this->classes); |
63 | 63 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function classesToAttribute() : string |
93 | 93 | { |
94 | - if(!empty($this->classes)) |
|
94 | + if (!empty($this->classes)) |
|
95 | 95 | { |
96 | 96 | return sprintf( |
97 | 97 | ' class="%s" ', |