GIF89a=( �' 7IAXKgNgYvYx\%wh&h}t�h%�s%x�}9�R��&�0%� (�.��5�SD��&�a)�x5��;ͣ*ȡ&ղ)ׯ7׵<ѻ4�3�H֧KͯT��Y�aq��q��F� !� ' !� NETSCAPE2.0 , =( ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g���E�������R���E����B�� ��ȸ��D���"�Ů� �H��L��D٫D�B�����D���T���H �G��A R�ڐ |�� ٭&��E8�S�kG�A�px�a��� R2XB��E8I���6X�:vT)�~��q�賥��"F~%x� � 4#Z�0O|-4Bs�X:= Q� Sal��yXJ`GȦ|s h��K3l7�B|�$'7Jީܪ0!��D�n=�P� ����0`�R�lj����v>���5 �.69�ϸd�����nlv�9��f{���Pbx �l5}�p� ��� �3a���I�O����!ܾ���i��9��#��)p�a ޽ �{�)vm��%D~ 6f��s}Œ�D�W E�`!� �&L8x� �ܝ{)x`X/>�}m��R�*|`D�=�_ ^�5 !_&'a�O�7�c��`DCx`�¥�9�Y�F���`?��"� �n@`�} lď��@4>�d S �v�xN��"@~d��=�g�s~G��� ���ud &p8Q�)ƫlXD����A~H�ySun�j���k*D�LH�] ��C"J��Xb~ʪwSt}6K,��q�S:9ت:���l�@�`�� �.۬�t9�S�[:��=`9N����{¿�A !R�:���6��x�0�_ �;������^���#����!����U���;0L1�����p% A��U̬ݵ��%�S��!���~`�G���� ���=4�np�3���������u�u�ٮ|%2�I��r�#0��J``8�@S@5� ���^`8E�]�.�S���7 � �0�j S�D� z���i�S�����!���l��w9*�D�I�nEX��� &A�Go�Qf��F��;���}�J����F5��Q|���X��T��y���]� o ��C=��:���PB@ D׽S�(>�C�x}`��xJЬ�۠��p+eE0`�}`A �/NE�� �9@��� H�7�!%B0`�l*��!8 2�%� �:�1�0E��ux%nP1�!�C)�P81l�ɸF#Ƭ{����B0>�� �b�`��O3��()yRpb��E.ZD8�H@% �Rx+%���c� ���f��b�d�`F�"8�XH"��-�|1�6iI, 2�$+](A*j� QT�o0.�U�`�R�}`�SN����yae�����b��o~ S)�y�@��3 �tT�0�&�+~L�f"�-|�~��>!�v��~�\Q1)}@�}h#aP72�"�$ !� " , =( &7IAXG]KgNgYvYxR"k\%w]'}h}t�h%�g+�s%r.m3ax3�x�}9��&��+�!7�0%� (�.�SD��&��;�"&ײ)׻4��6�K� �@pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E �� �������E �´��C���ǶR��D��"Ʒ�ʱH��M��GڬD�B����D��T����G���C�C� l&�~:'�tU�6ɹ#��)�'�.6�&��Ȼ K(8p0N�?!�2"��NIJX>R��OM '��2�*x�>#n� �@<[:�I�f ��T���Cdb��[�}E�5MBo��@�`@��tW-3 �x�B���jI�&E�9[T&$��ﯧ&"s��ȳ����dc�UUρ#���ldj?����`\}���u|3'�R]�6 �S#�!�FKL�*N E���`$�:e�YD�q�.�촁�s \-�jA 9�����-��M[�x(�s��x�|���p��}k�T�DpE@W� ��]k`1� ���Yb ��0l��*n0��"~zBd�~u�7�0Bl��0-�x~|U�U0 �h�*HS�|��e"#"?vp�i`e6^�+q��`m8 #V�� ��VS|`��"m"сSn|@:U���~`pb�G�ED����2F�I�? >�x� R� ��%~jx��<�a�9ij�2�D��&: Z`�]w���:�6��B�7eFJ|�ҧ�,���FǮcS�ʶ+B�,�ܺN���>PAD�HD��~���n��}�#�� Q��S���2�X�{�k�lQ�2�����w�|2� h9��G�,m���3��6-��E�L��I�³*K���q�`DwV�QXS��peS��� qܧTS����R�u �<�a�*At�lmE� � ��N[P1�ۦ��$��@`��Dpy�yXvCAy�B`}D� 0QwG#� �a[^�� $���Ǧ{L�"[��K�g�;�S~��GX.�goT.��ư��x���?1z��x~:�g�|�L� ��S`��0S]P�^p F<""�?!,�!N4&P� ����:T�@h�9%t��:�-~�I<`�9p I&.)^ 40D#p@�j4�ج:�01��rܼF2oW�#Z ;$Q q  �K��Nl#29 !F@�Bh�ᏬL!XF�LHKh�.�hE&J�G��<"WN!�����Y@� >R~19J"�2,/ &.GXB%�R�9B6�W]���W�I�$��9�RE8Y� ��"�A5�Q.axB�&ة�J�! �t)K%tS-�JF b�NMxL��)�R��"���6O!TH�H� 0 !� ) , =( &AXKgNgYvYxR"k\%wh&h}h%�g+�s%r.x3�x�}9��&��+�R,�!7�0%� (�.��5��&�a)��;�"&ף*Ȳ)ׯ7׻4�3��6�H֧KͻH�T��Y��q��h� ��pH,�Ȥr�l:xШtJ�Z�جv��z��xL.:��z�n���|N�����~�������& !�0`9R�}��"�"a:S�~x��������g �� E$����� � ����$E$��"��D� � ������R��C��� E ��H�M��G�D� �B��ϾD��a��`1r��Ӑ�� �o~�zU!L�C'�yW�UGt����ll�0���uG�)A�s[��x� �xO%��X2�  P�n:R/��aHae+�Dm?# ǣ6�8�J�x�Di�M���j���5oQ7�- <! *�l��R2r/a!l)d� A"�E���� &� ;��c �%����b��pe~C"B���H�eF2��`8qb�t_`ur`e� w�u3��Pv�h""�`�Íx�LĹ��3� �~ֺ�:���MDfJ� �۵�W�%�S�X �؁)�@��:E��w�u�Sxb8y\m�zS��Zb�E�L��w!y(>�"w�=�|��s�d �C�W)H�cC$�L �7r.�\{)@�`@ �X�$PD `aaG:���O�72E�amn]�"Rc�x�R� &dR8`g��i�xLR!�P &d����T���i�|�_ � Qi�#�`g:��:noM� :V �)p����W&a=�e�k� j���1߲s�x�W�jal|0��B0�, \j۴:6���C ��W��|��9���zĸV {�;��n��V�m�I��.��PN� ����C��+��By�ѾHŸ:��� 7�Y�FTk�SaoaY$D�S���29R�kt� ��f� ��:��Sp�3�I��DZ� �9���g��u�*3)O��[_hv ,���Et x�BH� �[��64M@�S�M7d�l�ܶ5-��U܍��z�R3Ԭ3~ ��P��5�g: ���kN�&0�j4���#{��3S�2�K�'ợl���2K{� {۶?~m𸧠�I�nE�='����^���_�=��~�#O���'���o..�Y�n��CSO��a��K��o,���b�����{�C�� "�{�K ��w��Ozdը�:$ ���v�] A#� ���a�z)Rx׿ƥ�d``�w-�y�f�K!����|��P��=�`�(f��'Pa ��BJa%��f�%`�}F����6>��`G"�}�=�!o`�^FP�ةQ�C���`(�}\�ݮ ��$<��n@dĠE#��U�I�!� #l��9`k���'Rr��Z�NB�MF �[�+9���-�wj���8�r� ,V�h"�|�S=�G_��"E� 0i*%̲��da0mVk�):;&6p>�jK ��# �D�:�c?:R Ӭf��I-�"�<�="��7�3S��c2RW ,�8(T"P0F¡Jh�" ; 403WebShell
403Webshell
Server IP : 173.249.157.85  /  Your IP : 216.73.217.145
Web Server : Apache
System : Linux server.frogzhost.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : econtech ( 1005)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/nette/utils/src/Utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/nette/utils/src/Utils/Html.php
<?php

/**
 * This file is part of the Nette Framework (https://nette.org)
 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
 */
declare (strict_types=1);
namespace RectorPrefix202411\Nette\Utils;

use RectorPrefix202411\Nette;
use RectorPrefix202411\Nette\HtmlStringable;
use function is_array, is_float, is_object, is_string;
/**
 * HTML helper.
 *
 * @property string|null $accept
 * @property string|null $accesskey
 * @property string|null $action
 * @property string|null $align
 * @property string|null $allow
 * @property string|null $alt
 * @property bool|null   $async
 * @property string|null $autocapitalize
 * @property string|null $autocomplete
 * @property bool|null   $autofocus
 * @property bool|null   $autoplay
 * @property string|null $charset
 * @property bool|null   $checked
 * @property string|null $cite
 * @property string|null $class
 * @property int|null    $cols
 * @property int|null    $colspan
 * @property string|null $content
 * @property bool|null   $contenteditable
 * @property bool|null   $controls
 * @property string|null $coords
 * @property string|null $crossorigin
 * @property string|null $data
 * @property string|null $datetime
 * @property string|null $decoding
 * @property bool|null   $default
 * @property bool|null   $defer
 * @property string|null $dir
 * @property string|null $dirname
 * @property bool|null   $disabled
 * @property bool|null   $download
 * @property string|null $draggable
 * @property string|null $dropzone
 * @property string|null $enctype
 * @property string|null $for
 * @property string|null $form
 * @property string|null $formaction
 * @property string|null $formenctype
 * @property string|null $formmethod
 * @property bool|null   $formnovalidate
 * @property string|null $formtarget
 * @property string|null $headers
 * @property int|null    $height
 * @property bool|null   $hidden
 * @property float|null  $high
 * @property string|null $href
 * @property string|null $hreflang
 * @property string|null $id
 * @property string|null $integrity
 * @property string|null $inputmode
 * @property bool|null   $ismap
 * @property string|null $itemprop
 * @property string|null $kind
 * @property string|null $label
 * @property string|null $lang
 * @property string|null $list
 * @property bool|null   $loop
 * @property float|null  $low
 * @property float|null  $max
 * @property int|null    $maxlength
 * @property int|null    $minlength
 * @property string|null $media
 * @property string|null $method
 * @property float|null  $min
 * @property bool|null   $multiple
 * @property bool|null   $muted
 * @property string|null $name
 * @property bool|null   $novalidate
 * @property bool|null   $open
 * @property float|null  $optimum
 * @property string|null $pattern
 * @property string|null $ping
 * @property string|null $placeholder
 * @property string|null $poster
 * @property string|null $preload
 * @property string|null $radiogroup
 * @property bool|null   $readonly
 * @property string|null $rel
 * @property bool|null   $required
 * @property bool|null   $reversed
 * @property int|null    $rows
 * @property int|null    $rowspan
 * @property string|null $sandbox
 * @property string|null $scope
 * @property bool|null   $selected
 * @property string|null $shape
 * @property int|null    $size
 * @property string|null $sizes
 * @property string|null $slot
 * @property int|null    $span
 * @property string|null $spellcheck
 * @property string|null $src
 * @property string|null $srcdoc
 * @property string|null $srclang
 * @property string|null $srcset
 * @property int|null    $start
 * @property float|null  $step
 * @property string|null $style
 * @property int|null    $tabindex
 * @property string|null $target
 * @property string|null $title
 * @property string|null $translate
 * @property string|null $type
 * @property string|null $usemap
 * @property string|null $value
 * @property int|null    $width
 * @property string|null $wrap
 *
 * @method self accept(?string $val)
 * @method self accesskey(?string $val, bool $state = null)
 * @method self action(?string $val)
 * @method self align(?string $val)
 * @method self allow(?string $val, bool $state = null)
 * @method self alt(?string $val)
 * @method self async(?bool $val)
 * @method self autocapitalize(?string $val)
 * @method self autocomplete(?string $val)
 * @method self autofocus(?bool $val)
 * @method self autoplay(?bool $val)
 * @method self charset(?string $val)
 * @method self checked(?bool $val)
 * @method self cite(?string $val)
 * @method self class(?string $val, bool $state = null)
 * @method self cols(?int $val)
 * @method self colspan(?int $val)
 * @method self content(?string $val)
 * @method self contenteditable(?bool $val)
 * @method self controls(?bool $val)
 * @method self coords(?string $val)
 * @method self crossorigin(?string $val)
 * @method self datetime(?string $val)
 * @method self decoding(?string $val)
 * @method self default(?bool $val)
 * @method self defer(?bool $val)
 * @method self dir(?string $val)
 * @method self dirname(?string $val)
 * @method self disabled(?bool $val)
 * @method self download(?bool $val)
 * @method self draggable(?string $val)
 * @method self dropzone(?string $val)
 * @method self enctype(?string $val)
 * @method self for(?string $val)
 * @method self form(?string $val)
 * @method self formaction(?string $val)
 * @method self formenctype(?string $val)
 * @method self formmethod(?string $val)
 * @method self formnovalidate(?bool $val)
 * @method self formtarget(?string $val)
 * @method self headers(?string $val, bool $state = null)
 * @method self height(?int $val)
 * @method self hidden(?bool $val)
 * @method self high(?float $val)
 * @method self hreflang(?string $val)
 * @method self id(?string $val)
 * @method self integrity(?string $val)
 * @method self inputmode(?string $val)
 * @method self ismap(?bool $val)
 * @method self itemprop(?string $val)
 * @method self kind(?string $val)
 * @method self label(?string $val)
 * @method self lang(?string $val)
 * @method self list(?string $val)
 * @method self loop(?bool $val)
 * @method self low(?float $val)
 * @method self max(?float $val)
 * @method self maxlength(?int $val)
 * @method self minlength(?int $val)
 * @method self media(?string $val)
 * @method self method(?string $val)
 * @method self min(?float $val)
 * @method self multiple(?bool $val)
 * @method self muted(?bool $val)
 * @method self name(?string $val)
 * @method self novalidate(?bool $val)
 * @method self open(?bool $val)
 * @method self optimum(?float $val)
 * @method self pattern(?string $val)
 * @method self ping(?string $val, bool $state = null)
 * @method self placeholder(?string $val)
 * @method self poster(?string $val)
 * @method self preload(?string $val)
 * @method self radiogroup(?string $val)
 * @method self readonly(?bool $val)
 * @method self rel(?string $val)
 * @method self required(?bool $val)
 * @method self reversed(?bool $val)
 * @method self rows(?int $val)
 * @method self rowspan(?int $val)
 * @method self sandbox(?string $val, bool $state = null)
 * @method self scope(?string $val)
 * @method self selected(?bool $val)
 * @method self shape(?string $val)
 * @method self size(?int $val)
 * @method self sizes(?string $val)
 * @method self slot(?string $val)
 * @method self span(?int $val)
 * @method self spellcheck(?string $val)
 * @method self src(?string $val)
 * @method self srcdoc(?string $val)
 * @method self srclang(?string $val)
 * @method self srcset(?string $val)
 * @method self start(?int $val)
 * @method self step(?float $val)
 * @method self style(?string $property, string $val = null)
 * @method self tabindex(?int $val)
 * @method self target(?string $val)
 * @method self title(?string $val)
 * @method self translate(?string $val)
 * @method self type(?string $val)
 * @method self usemap(?string $val)
 * @method self value(?string $val)
 * @method self width(?int $val)
 * @method self wrap(?string $val)
 */
class Html implements \ArrayAccess, \Countable, \IteratorAggregate, HtmlStringable
{
    use Nette\SmartObject;
    /** @var array<string, mixed>  element's attributes */
    public $attrs = [];
    /** void elements */
    public static $emptyElements = ['img' => 1, 'hr' => 1, 'br' => 1, 'input' => 1, 'meta' => 1, 'area' => 1, 'embed' => 1, 'keygen' => 1, 'source' => 1, 'base' => 1, 'col' => 1, 'link' => 1, 'param' => 1, 'basefont' => 1, 'frame' => 1, 'isindex' => 1, 'wbr' => 1, 'command' => 1, 'track' => 1];
    /** @var array<int, HtmlStringable|string> nodes */
    protected $children = [];
    /** element's name
     * @var string */
    private $name = '';
    /**
     * @var bool
     */
    private $isEmpty = \false;
    /**
     * Constructs new HTML element.
     * @param  array|string $attrs element's attributes or plain text content
     * @return static
     */
    public static function el(?string $name = null, $attrs = null)
    {
        $el = new static();
        $parts = \explode(' ', (string) $name, 2);
        $el->setName($parts[0]);
        if (is_array($attrs)) {
            $el->attrs = $attrs;
        } elseif ($attrs !== null) {
            $el->setText($attrs);
        }
        if (isset($parts[1])) {
            foreach (Strings::matchAll($parts[1] . ' ', '#([a-z0-9:-]+)(?:=(["\'])?(.*?)(?(2)\\2|\\s))?#i') as $m) {
                $el->attrs[$m[1]] = $m[3] ?? \true;
            }
        }
        return $el;
    }
    /**
     * Returns an object representing HTML text.
     * @return static
     */
    public static function fromHtml(string $html)
    {
        return (new static())->setHtml($html);
    }
    /**
     * Returns an object representing plain text.
     * @return static
     */
    public static function fromText(string $text)
    {
        return (new static())->setText($text);
    }
    /**
     * Converts to HTML.
     */
    public final function toHtml() : string
    {
        return $this->render();
    }
    /**
     * Converts to plain text.
     */
    public final function toText() : string
    {
        return $this->getText();
    }
    /**
     * Converts given HTML code to plain text.
     */
    public static function htmlToText(string $html) : string
    {
        return \html_entity_decode(\strip_tags($html), \ENT_QUOTES | \ENT_HTML5, 'UTF-8');
    }
    /**
     * Changes element's name.
     * @return static
     */
    public final function setName(string $name, ?bool $isEmpty = null)
    {
        $this->name = $name;
        $this->isEmpty = $isEmpty ?? isset(static::$emptyElements[$name]);
        return $this;
    }
    /**
     * Returns element's name.
     */
    public final function getName() : string
    {
        return $this->name;
    }
    /**
     * Is element empty?
     */
    public final function isEmpty() : bool
    {
        return $this->isEmpty;
    }
    /**
     * Sets multiple attributes.
     * @return static
     */
    public function addAttributes(array $attrs)
    {
        $this->attrs = \array_merge($this->attrs, $attrs);
        return $this;
    }
    /**
     * Appends value to element's attribute.
     * @param mixed $value
     * @param mixed $option
     * @return static
     */
    public function appendAttribute(string $name, $value, $option = \true)
    {
        if (is_array($value)) {
            $prev = isset($this->attrs[$name]) ? (array) $this->attrs[$name] : [];
            $this->attrs[$name] = $value + $prev;
        } elseif ((string) $value === '') {
            $tmp =& $this->attrs[$name];
            // appending empty value? -> ignore, but ensure it exists
        } elseif (!isset($this->attrs[$name]) || is_array($this->attrs[$name])) {
            // needs array
            $this->attrs[$name][$value] = $option;
        } else {
            $this->attrs[$name] = [$this->attrs[$name] => \true, $value => $option];
        }
        return $this;
    }
    /**
     * Sets element's attribute.
     * @param mixed $value
     * @return static
     */
    public function setAttribute(string $name, $value)
    {
        $this->attrs[$name] = $value;
        return $this;
    }
    /**
     * Returns element's attribute.
     * @return mixed
     */
    public function getAttribute(string $name)
    {
        return $this->attrs[$name] ?? null;
    }
    /**
     * Unsets element's attribute.
     * @return static
     */
    public function removeAttribute(string $name)
    {
        unset($this->attrs[$name]);
        return $this;
    }
    /**
     * Unsets element's attributes.
     * @return static
     */
    public function removeAttributes(array $attributes)
    {
        foreach ($attributes as $name) {
            unset($this->attrs[$name]);
        }
        return $this;
    }
    /**
     * Overloaded setter for element's attribute.
     * @param mixed $value
     */
    public final function __set(string $name, $value) : void
    {
        $this->attrs[$name] = $value;
    }
    /**
     * Overloaded getter for element's attribute.
     * @return mixed
     */
    public final function &__get(string $name)
    {
        return $this->attrs[$name];
    }
    /**
     * Overloaded tester for element's attribute.
     */
    public final function __isset(string $name) : bool
    {
        return isset($this->attrs[$name]);
    }
    /**
     * Overloaded unsetter for element's attribute.
     */
    public final function __unset(string $name) : void
    {
        unset($this->attrs[$name]);
    }
    /**
     * Overloaded setter for element's attribute.
     * @return mixed
     */
    public final function __call(string $m, array $args)
    {
        $p = \substr($m, 0, 3);
        if ($p === 'get' || $p === 'set' || $p === 'add') {
            $m = \substr($m, 3);
            $m[0] = $m[0] | " ";
            if ($p === 'get') {
                return $this->attrs[$m] ?? null;
            } elseif ($p === 'add') {
                $args[] = \true;
            }
        }
        if (\count($args) === 0) {
            // invalid
        } elseif (\count($args) === 1) {
            // set
            $this->attrs[$m] = $args[0];
        } else {
            // add
            $this->appendAttribute($m, $args[0], $args[1]);
        }
        return $this;
    }
    /**
     * Special setter for element's attribute.
     * @return static
     */
    public final function href(string $path, array $query = [])
    {
        if ($query) {
            $query = \http_build_query($query, '', '&');
            if ($query !== '') {
                $path .= '?' . $query;
            }
        }
        $this->attrs['href'] = $path;
        return $this;
    }
    /**
     * Setter for data-* attributes. Booleans are converted to 'true' resp. 'false'.
     * @param mixed $value
     * @return static
     */
    public function data(string $name, $value = null)
    {
        if (\func_num_args() === 1) {
            $this->attrs['data'] = $name;
        } else {
            $this->attrs["data-{$name}"] = \is_bool($value) ? \json_encode($value) : $value;
        }
        return $this;
    }
    /**
     * Sets element's HTML content.
     * @param mixed $html
     * @return static
     */
    public final function setHtml($html)
    {
        $this->children = [(string) $html];
        return $this;
    }
    /**
     * Returns element's HTML content.
     */
    public final function getHtml() : string
    {
        return \implode('', $this->children);
    }
    /**
     * Sets element's textual content.
     * @param mixed $text
     * @return static
     */
    public final function setText($text)
    {
        if (!$text instanceof HtmlStringable) {
            $text = \htmlspecialchars((string) $text, \ENT_NOQUOTES, 'UTF-8');
        }
        $this->children = [(string) $text];
        return $this;
    }
    /**
     * Returns element's textual content.
     */
    public final function getText() : string
    {
        return self::htmlToText($this->getHtml());
    }
    /**
     * Adds new element's child.
     * @param mixed $child
     * @return static
     */
    public final function addHtml($child)
    {
        return $this->insert(null, $child);
    }
    /**
     * Appends plain-text string to element content.
     * @param mixed $text
     * @return static
     */
    public function addText($text)
    {
        if (!$text instanceof HtmlStringable) {
            $text = \htmlspecialchars((string) $text, \ENT_NOQUOTES, 'UTF-8');
        }
        return $this->insert(null, $text);
    }
    /**
     * Creates and adds a new Html child.
     * @param mixed[]|string|null $attrs
     * @return static
     */
    public final function create(string $name, $attrs = null)
    {
        $this->insert(null, $child = static::el($name, $attrs));
        return $child;
    }
    /**
     * Inserts child node.
     * @param \Nette\HtmlStringable|string $child
     * @return static
     */
    public function insert(?int $index, $child, bool $replace = \false)
    {
        $child = $child instanceof self ? $child : (string) $child;
        if ($index === null) {
            // append
            $this->children[] = $child;
        } else {
            // insert or replace
            \array_splice($this->children, $index, $replace ? 1 : 0, [$child]);
        }
        return $this;
    }
    /**
     * Inserts (replaces) child node (\ArrayAccess implementation).
     * @param  int|null  $index  position or null for appending
     * @param  Html|string  $child  Html node or raw HTML string
     */
    public final function offsetSet($index, $child) : void
    {
        $this->insert($index, $child, \true);
    }
    /**
     * Returns child node (\ArrayAccess implementation).
     * @param  int  $index
     * @return \Nette\HtmlStringable|string
     */
    #[\ReturnTypeWillChange]
    public final function offsetGet($index)
    {
        return $this->children[$index];
    }
    /**
     * Exists child node? (\ArrayAccess implementation).
     * @param  int  $index
     */
    public final function offsetExists($index) : bool
    {
        return isset($this->children[$index]);
    }
    /**
     * Removes child node (\ArrayAccess implementation).
     * @param  int  $index
     */
    public function offsetUnset($index) : void
    {
        if (isset($this->children[$index])) {
            \array_splice($this->children, $index, 1);
        }
    }
    /**
     * Returns children count.
     */
    public final function count() : int
    {
        return \count($this->children);
    }
    /**
     * Removes all children.
     */
    public function removeChildren() : void
    {
        $this->children = [];
    }
    /**
     * Iterates over elements.
     * @return \ArrayIterator<int, HtmlStringable|string>
     */
    public final function getIterator() : \ArrayIterator
    {
        return new \ArrayIterator($this->children);
    }
    /**
     * Returns all children.
     */
    public final function getChildren() : array
    {
        return $this->children;
    }
    /**
     * Renders element's start tag, content and end tag.
     */
    public final function render(?int $indent = null) : string
    {
        $s = $this->startTag();
        if (!$this->isEmpty) {
            // add content
            if ($indent !== null) {
                $indent++;
            }
            foreach ($this->children as $child) {
                if ($child instanceof self) {
                    $s .= $child->render($indent);
                } else {
                    $s .= $child;
                }
            }
            // add end tag
            $s .= $this->endTag();
        }
        if ($indent !== null) {
            return "\n" . \str_repeat("\t", $indent - 1) . $s . "\n" . \str_repeat("\t", \max(0, $indent - 2));
        }
        return $s;
    }
    public final function __toString() : string
    {
        return $this->render();
    }
    /**
     * Returns element's start tag.
     */
    public final function startTag() : string
    {
        return $this->name ? '<' . $this->name . $this->attributes() . '>' : '';
    }
    /**
     * Returns element's end tag.
     */
    public final function endTag() : string
    {
        return $this->name && !$this->isEmpty ? '</' . $this->name . '>' : '';
    }
    /**
     * Returns element's attributes.
     * @internal
     */
    public final function attributes() : string
    {
        if (!is_array($this->attrs)) {
            return '';
        }
        $s = '';
        $attrs = $this->attrs;
        foreach ($attrs as $key => $value) {
            if ($value === null || $value === \false) {
                continue;
            } elseif ($value === \true) {
                $s .= ' ' . $key;
                continue;
            } elseif (is_array($value)) {
                if (\strncmp($key, 'data-', 5) === 0) {
                    $value = Json::encode($value);
                } else {
                    $tmp = null;
                    foreach ($value as $k => $v) {
                        if ($v != null) {
                            // intentionally ==, skip nulls & empty string
                            // composite 'style' vs. 'others'
                            $tmp[] = $v === \true ? $k : (is_string($k) ? $k . ':' . $v : $v);
                        }
                    }
                    if ($tmp === null) {
                        continue;
                    }
                    $value = \implode($key === 'style' || !\strncmp($key, 'on', 2) ? ';' : ' ', $tmp);
                }
            } elseif (is_float($value)) {
                $value = \rtrim(\rtrim(\number_format($value, 10, '.', ''), '0'), '.');
            } else {
                $value = (string) $value;
            }
            $q = \strpos($value, '"') !== \false ? "'" : '"';
            $s .= ' ' . $key . '=' . $q . \str_replace(['&', $q, '<'], ['&amp;', $q === '"' ? '&quot;' : '&#39;', '<'], $value) . (\strpos($value, '`') !== \false && \strpbrk($value, ' <>"\'') === \false ? ' ' : '') . $q;
        }
        $s = \str_replace('@', '&#64;', $s);
        return $s;
    }
    /**
     * Clones all children too.
     */
    public function __clone()
    {
        foreach ($this->children as $key => $value) {
            if (is_object($value)) {
                $this->children[$key] = clone $value;
            }
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit