@@ -84,7 +84,7 @@ public static function el(string $name = NULL, $attrs = NULL)
8484 * @return static
8585 * @throws Nette\InvalidArgumentException
8686 */
87- public function setName (string $ name , bool $ isEmpty = NULL )
87+ final public function setName (string $ name , bool $ isEmpty = NULL )
8888 {
8989 $ this ->name = $ name ;
9090 $ this ->isEmpty = $ isEmpty === NULL ? isset (static ::$ emptyElements [$ name ]) : $ isEmpty ;
@@ -95,7 +95,7 @@ public function setName(string $name, bool $isEmpty = NULL)
9595 /**
9696 * Returns element's name.
9797 */
98- public function getName (): string
98+ final public function getName (): string
9999 {
100100 return $ this ->name ;
101101 }
@@ -104,7 +104,7 @@ public function getName(): string
104104 /**
105105 * Is element empty?
106106 */
107- public function isEmpty (): bool
107+ final public function isEmpty (): bool
108108 {
109109 return $ this ->isEmpty ;
110110 }
@@ -180,7 +180,7 @@ public function removeAttribute(string $name)
180180 * Overloaded setter for element's attribute.
181181 * @return void
182182 */
183- public function __set (string $ name , $ value )
183+ final public function __set (string $ name , $ value )
184184 {
185185 $ this ->attrs [$ name ] = $ value ;
186186 }
@@ -190,7 +190,7 @@ public function __set(string $name, $value)
190190 * Overloaded getter for element's attribute.
191191 * @return mixed
192192 */
193- public function &__get (string $ name )
193+ final public function &__get (string $ name )
194194 {
195195 return $ this ->attrs [$ name ];
196196 }
@@ -199,7 +199,7 @@ public function &__get(string $name)
199199 /**
200200 * Overloaded tester for element's attribute.
201201 */
202- public function __isset (string $ name ): bool
202+ final public function __isset (string $ name ): bool
203203 {
204204 return isset ($ this ->attrs [$ name ]);
205205 }
@@ -209,7 +209,7 @@ public function __isset(string $name): bool
209209 * Overloaded unsetter for element's attribute.
210210 * @return void
211211 */
212- public function __unset (string $ name )
212+ final public function __unset (string $ name )
213213 {
214214 unset($ this ->attrs [$ name ]);
215215 }
@@ -219,7 +219,7 @@ public function __unset(string $name)
219219 * Overloaded setter for element's attribute.
220220 * @return mixed
221221 */
222- public function __call (string $ m , array $ args )
222+ final public function __call (string $ m , array $ args )
223223 {
224224 $ p = substr ($ m , 0 , 3 );
225225 if ($ p === 'get ' || $ p === 'set ' || $ p === 'add ' ) {
@@ -250,7 +250,7 @@ public function __call(string $m, array $args)
250250 * Special setter for element's attribute.
251251 * @return static
252252 */
253- public function href (string $ path , array $ query = NULL )
253+ final public function href (string $ path , array $ query = NULL )
254254 {
255255 if ($ query ) {
256256 $ query = http_build_query ($ query , '' , '& ' );
@@ -283,7 +283,7 @@ public function data(string $name, $value = NULL)
283283 * @return static
284284 * @throws Nette\InvalidArgumentException
285285 */
286- public function setHtml ($ html )
286+ final public function setHtml ($ html )
287287 {
288288 if (is_array ($ html )) {
289289 throw new Nette \InvalidArgumentException (sprintf ('Textual content must be a scalar, %s given. ' , gettype ($ html )));
@@ -297,7 +297,7 @@ public function setHtml($html)
297297 /**
298298 * Returns element's HTML content.
299299 */
300- public function getHtml (): string
300+ final public function getHtml (): string
301301 {
302302 $ s = '' ;
303303 foreach ($ this ->children as $ child ) {
@@ -316,7 +316,7 @@ public function getHtml(): string
316316 * @return static
317317 * @throws Nette\InvalidArgumentException
318318 */
319- public function setText ($ text )
319+ final public function setText ($ text )
320320 {
321321 if (!is_array ($ text ) && !$ text instanceof self) {
322322 $ text = htmlspecialchars ((string ) $ text , ENT_NOQUOTES , 'UTF-8 ' );
@@ -328,7 +328,7 @@ public function setText($text)
328328 /**
329329 * Returns element's textual content.
330330 */
331- public function getText (): string
331+ final public function getText (): string
332332 {
333333 return html_entity_decode (strip_tags ($ this ->getHtml ()), ENT_QUOTES , 'UTF-8 ' );
334334 }
@@ -339,7 +339,7 @@ public function getText(): string
339339 * @param Html|string Html node or raw HTML string
340340 * @return static
341341 */
342- public function addHtml ($ child )
342+ final public function addHtml ($ child )
343343 {
344344 return $ this ->insert (NULL , $ child );
345345 }
@@ -361,7 +361,7 @@ public function addText(string $text)
361361 * @param array|string $attrs element's attributes or raw HTML string
362362 * @return static created element
363363 */
364- public function create (string $ name , $ attrs = NULL )
364+ final public function create (string $ name , $ attrs = NULL )
365365 {
366366 $ this ->insert (NULL , $ child = static ::el ($ name , $ attrs ));
367367 return $ child ;
@@ -398,7 +398,7 @@ public function insert(int $index = NULL, $child, bool $replace = FALSE)
398398 * @param Html|string Html node or raw HTML string
399399 * @return void
400400 */
401- public function offsetSet ($ index , $ child )
401+ final public function offsetSet ($ index , $ child )
402402 {
403403 $ this ->insert ($ index , $ child , TRUE );
404404 }
@@ -409,7 +409,7 @@ public function offsetSet($index, $child)
409409 * @param int
410410 * @return static|string
411411 */
412- public function offsetGet ($ index )
412+ final public function offsetGet ($ index )
413413 {
414414 return $ this ->children [$ index ];
415415 }
@@ -419,7 +419,7 @@ public function offsetGet($index)
419419 * Exists child node? (\ArrayAccess implementation).
420420 * @param int
421421 */
422- public function offsetExists ($ index ): bool
422+ final public function offsetExists ($ index ): bool
423423 {
424424 return isset ($ this ->children [$ index ]);
425425 }
@@ -441,7 +441,7 @@ public function offsetUnset($index)
441441 /**
442442 * Returns children count.
443443 */
444- public function count (): int
444+ final public function count (): int
445445 {
446446 return count ($ this ->children );
447447 }
@@ -460,7 +460,7 @@ public function removeChildren()
460460 /**
461461 * Iterates over elements.
462462 */
463- public function getIterator (): \ArrayIterator
463+ final public function getIterator (): \ArrayIterator
464464 {
465465 return new \ArrayIterator ($ this ->children );
466466 }
@@ -469,7 +469,7 @@ public function getIterator(): \ArrayIterator
469469 /**
470470 * Returns all children.
471471 */
472- public function getChildren (): array
472+ final public function getChildren (): array
473473 {
474474 return $ this ->children ;
475475 }
@@ -478,7 +478,7 @@ public function getChildren(): array
478478 /**
479479 * Renders element's start tag, content and end tag.
480480 */
481- public function render (int $ indent = NULL ): string
481+ final public function render (int $ indent = NULL ): string
482482 {
483483 $ s = $ this ->startTag ();
484484
@@ -506,7 +506,7 @@ public function render(int $indent = NULL): string
506506 }
507507
508508
509- public function __toString (): string
509+ final public function __toString (): string
510510 {
511511 try {
512512 return $ this ->render ();
@@ -519,7 +519,7 @@ public function __toString(): string
519519 /**
520520 * Returns element's start tag.
521521 */
522- public function startTag (): string
522+ final public function startTag (): string
523523 {
524524 if ($ this ->name ) {
525525 return '< ' . $ this ->name . $ this ->attributes () . (static ::$ xhtml && $ this ->isEmpty ? ' /> ' : '> ' );
@@ -533,7 +533,7 @@ public function startTag(): string
533533 /**
534534 * Returns element's end tag.
535535 */
536- public function endTag (): string
536+ final public function endTag (): string
537537 {
538538 return $ this ->name && !$ this ->isEmpty ? '</ ' . $ this ->name . '> ' : '' ;
539539 }
@@ -543,7 +543,7 @@ public function endTag(): string
543543 * Returns element's attributes.
544544 * @internal
545545 */
546- public function attributes (): string
546+ final public function attributes (): string
547547 {
548548 if (!is_array ($ this ->attrs )) {
549549 return '' ;
0 commit comments