Генерирует значение аргумента

@param            $key
@param            $value

@param DOMElement $argElement

@return string
497479
public function buildArgValue($key, $value, DOMElement $argElement)
    {
        $dom = $argElement->ownerDocument;
        $argValueElement = $dom->createCDATASection($value);
        $argElement->appendChild($argValueElement);
    }
248812
public static function setDOMElementValue(DOMElement $element, $value)
    {
        switch (gettype($value)) {
            case 'boolean':
                $element->nodeValue = ($value === true) ? 'true' : 'false';
            break;

            default:
                $element->nodeValue = $value;
            break;
        }
    }
264721
public function withKey($key, $value, callable $callable)
    {
        $initialValue = $this->get($key);
        try {
            $this->set($key, $value);

            return $callable();
        } finally {
            $this->set($key, $initialValue);
        }
    }
375308
public static function make_textarea( $id, $key, $value = '', $attr = array() ) 
	{
		$element = HTML::tag( 'textarea', _e( $value ), array_merge( array( 
			'id' => $id, 
			'name' => $key,
		), $attr ));

		if ( !static::$builder_enabled )
		{
			 return $element;
		}

		return Builder::handle( 'form_textarea', $element );
	}
360851
protected function mapExportAttribute($value, $key)
    {
        // If an images relationship
        if ($key == 'images') {
            return implode(',', array_map(function($image) {
                return $image['file'];
            }, $value));
        }

        // If another array...
        if (is_array($value)) {
            return implode(',', array_map(function($child) {

                // If sub array, like if this was some relation, return the id
                // so this becomes an array of those ids
                if (is_array($child) && isset($child['id'])) {
                    return $child['id'];
                }

                // If anything else, just return it
                return $child;
            }, $value));
        }

        // Otherwise, just pass through value
        return $value;
    }
198815
protected final function appendValueTo(
       SimpleXMLElement $parent,
       $key,
       $value): SimpleXMLElement
   {
       $parent->addChild($key);
       if (is_object($value) || is_array($value)) {
           foreach ($value as $subKey => $subValue) {
               $this->appendValueTo($parent->{$key}, $subKey, $subValue);
           }
           if (!isset($subKey)) {
               $parent->{$key}[0] = "";
           }
       } else if (is_scalar($value) || !$value) {
           $parent->{$key}[0] = (string) $value;
       }
       return $parent->{$key};
   }
556916
public function withAttribute(string $key, $value): ElementInterface
    {
        if ($key === 'value' && is_array($value)) {
            foreach ($this->elements as $name => $element) {
                $this->elements[$name]->withValue($value[$name] ?? '');
            }

            return $this;
        }

        parent::withAttribute($key, $value);

        return $this;
    }
40062
protected function attribute($key, $value)
    {
        if (is_numeric($key)) {
            $key = $value;
        }

        if (!is_null($value)) {
            return $key.'="'.$value.'"';
        }
    }
1047764
public function getMockedArgValue($elementName, $argName)
    {
        if (isset($this->_mockedArguments[$elementName]) && isset($this->_mockedArguments[$elementName][$argName])) {
            $response = $this->_mockedArguments[$elementName][$argName];
            if (is_callable($response)) {
                $response = call_user_func($response);
            }
            return $response;
        }
        
        return false;
    }
539996
public function set( $selector, $key, $value = NULL ){
		if( $value === NULL || !strlen( $value ) )
			return $this->remove( $selector, $key );
		$rule = $this->getRuleBySelector( $selector );
		if( !$rule ){
			$rule	= new ADT_CSS_Rule( $selector );
			$this->rules[]	= $rule;
		}
		return $rule->setPropertyByKey( $key, $value );
	}
929146
public function setAttribute($key, $value)
	{
		// Hash required fields when necessary
		if (in_array($key, $this->hashableAttributes) and ! empty($value))
		{
			$value = $this->hash($value);
		}

		return parent::setAttribute($key, $value);
	}
293137
public static function selectSingleNode(\DOMNode $pNode, $xPath, $arNamespace = null) // <- Retorna
    {
        $rNodeList = self::selectNodes($pNode, $xPath, $arNamespace);

        return $rNodeList->item(0);
    }
553953
private function parseValue(string $key, $value): string
    {

        if (is_array($value)) {
            return $this->parseArray($key, $value);
        }

        return $this->parseScalar($key, $value);
    }
570120
public function set($key, $value)
    {
        if (is_array($key) && $value === null)
            $args = $key;
        else
            $args = func_get_args();

        $path = $args;
        $value = array_pop($path);
        $type = $this->types->dget($path);
        $kpath = implode('.', $path);

        // Key is undefined, but it may be in a untyped sub-array
        if ($type === null)
        {
            $cpy = $path;
            while (count($cpy))
            {
                $last = array_pop($cpy);
                $subtype = $this->types->dget($cpy);
                if ($subtype instanceof Validator && $subtype->getType() === Type::ARRAY)
                    return parent::set($args, null);
            }
        }

        if ($type === null)
            throw new \InvalidArgumentException("Undefined key: " . $kpath);

        if ($type instanceof Dictionary)
        {
            // Subfiltering required - extract values
            if (!Functions::is_array_like($value))
                throw new \InvalidArgumentException("Value must be array at: " . $kpath);

            foreach ($value as $subkey => $subval)
            {
                $nargs = $path;
                $nargs[] = $subkey;
                $nargs[] = $subval;
                $this->set($nargs, null);
            }
            return;
        }

        if (!$type->validate($value))
        {
            $error = $type->getErrorMessage($value);
            $msg = WF::fillPlaceholders($error['msg'], $error['context'] ?? []);
            throw new \InvalidArgumentException($msg);
        }

        return parent::set($args, null);
    }
853457
protected function writeArgs(DOMElement $parent)
    {
        $args = $this->getArgs();
        if (count($args) > 0) {
            $dom = $parent->ownerDocument;
            $argBase = $dom->createElement('arg');
            foreach ($args as $key => $value) {
                $arg = clone $argBase;
                $arg->setAttribute('name', $key);

                if ($this instanceof CustomArgInterface && $this->flagUseCustomArgWriter($key, $value)) {
                    $this->buildArgValue($key, $value, $arg);
                } else {
                    $valueArgElement = $dom->createTextNode($value);
                    $arg->appendChild($valueArgElement);
                }

                $parent->appendChild($arg);
            }
        }
    }
404742
public function setHeader( $key, $value )
	{
		if( !in_array( $key, $this->headers ) )
			throw new InvalidArgumentException( "Unsupported Header '".$key."'" );
		$children	=& $this->tree->getChildren();
		$head		=& $children[0];
		$node		= new XML_DOM_Node( $key, $value );
		$head->addChild( $node );
	}
199451
protected function getHtmlAttribValue($key, $value)
    {
        if (('on' == substr($key, 0, 2)) || ('constraints' == $key)) {
            // Don't escape event attributes; _do_ substitute double quotes with singles
            if (!is_scalar($value)) {
                // Non-scalar data should be cast to JSON first
                return Json::encode($value);
            }
            return $value;
        }
        
        if (is_array($value)) {
            return implode(' ', $value);
        }
        
        return $value;
    }