403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/export/xml/data/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/yandex.market/lib/export/xml/data/arrayelement.php
<?php
namespace Yandex\Market\Export\Xml\Data;

class ArrayElement implements ExportElement
{
	/** @var string */
	private $name;
	/** @var mixed|null */
    private $value;
	/** @var static[] */
    private $children = [];
    private $multipleChildren = [];

	public function __construct($name, $value = null)
	{
		$this->name = (string)$name;
		$this->value = $value;
	}

	public function getName()
	{
		return $this->name;
	}

	public function getValue()
	{
		return $this->value;
	}

    public function setValue($value)
    {
        return $this->value = $value;
    }

    public function appendValue($value, $glue)
	{
		if ($this->value === null || $this->value === '')
		{
			$this->value = $value;
			return;
		}

		$this->value .= $glue . $value;
	}

	public function hasChildren()
	{
		return !empty($this->children);
	}

	public function getChildren()
	{
		return $this->children;
	}

	public function getChild($name)
	{
        $result = [];

        foreach ($this->children as $child)
        {
            if ($child->getName() === $name)
            {
                $result[] = $child;
            }
        }

		return $result;
	}

	public function addChild($name, $value = null, $multiple = false)
	{
        if ($multiple) { $this->multipleChildren[$name] = true; }

        $child = new static($name, $value);
		$this->children[] = $child;

		return $child;
	}

	public function removeChild(ExportElement $child)
	{
        $index = array_search($child, $this->children, true);

        if ($index === false) { return; }

        array_splice($this->children, $index, 1);
	}

	public function build()
	{
		if (!empty($this->children))
		{
			$result = [];

			if ($this->value !== null && !($this->value instanceof RootValue))
			{
				$result['value'] = $this->castValue();
			}

			foreach ($this->children as $child)
			{
                $name = $child->getName();

                if (isset($this->multipleChildren[$name]))
                {
                    if (!isset($result[$name])) { $result[$name] = []; }

                    $result[$name][] = $child->build();
                    continue;
                }

				$result[$name] = $child->build();
			}

			return $result;
		}

        return $this->castValue();
	}

    private function castValue()
    {
        if (!is_scalar($this->value) && !is_array($this->value))
        {
            return (string)$this->value;
        }

        return $this->value;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit