@param \DOMNode $node
@param string $target
@param string $value

@return string
420551
static protected function _resolve_target(\DOMNode $node, $target, $value)
    {
        if ($target[0] === "!") {
            // Function call
            $func = "_" . mb_substr($target, 1);

            return self::$func($node, $value);
        }

        return $value ? sprintf($target, $value) : "";
    }
391211
function _getTargetNode(d, property) {
  if(d.get('target.type') === DataProcessor.types.OUTPUT && d.get('source.' + property)) {
    return d.source;
  }
  if(d.get('target.' + property)) {
    return d.target;
  }
}
478931
private function setElementValue(DOMDocument $dom, DOMElement $node, $value = null)
    {
        if ($value instanceof \SimpleXMLElement) {
            return $node->appendChild($dom->importNode(dom_import_simplexml($value), true));
        }

        if ($value instanceof \DOMDocument) {
            return $node->appendDomElement($value->firstChild);
        }

        if ($value instanceof \DOMElement) {
            return $dom->appendDomElement($value, $node);
        }

        if (is_array($value) || $value instanceof \Traversable) {
            return $this->buildXML($dom, $node, $value);
        }

        if (is_int($value) || is_float($value)) {
            return $this->createText($dom, $node, (string)$value);
        }

        if (is_bool($value)) {
            return $this->createText($dom, $node, $value ? 'true' : 'false');
        }

        if (is_string($value) || null === $value) {
            return $this->appendTextNode($dom, $node, (string)$value);
        }

        return false;
    }
808533
private function extractText(DOMNode $node)
    {
        $text = '';

        if ($node->childNodes) {
            foreach ($node->childNodes as $child) {
                $text .= $this->extractText($child);
            }
        } else {
            $text .= $node->nodeValue . ' ';
        }

        return $text;
    }
580523
private function createCDATASection(\DOMDocument $dom, \DOMNode $node, $value)
    {
        $cdata = $dom->createCDATASection($value);
        $node->appendChild($cdata);
    }
448616
private function normalizeValue($value)
    {
        if ($value instanceof NodeInterface) {
            $value = IDEncoder::encode($value);
        } elseif (\is_object($value)) {
            if (method_exists($value, '__toString')) {
                $value = (string) $value;
            } else {
                $value = null;
            }
        }

        return $value;
    }
792906
public function handleNode(NodeValue $value, Closure $next)
    {
        $this->nodeRegistry->registerModel(
            $value->getTypeDefinitionName(),
            $this->getModelClass('class')
        );

        return $next($value);
    }
605468
public function tokenize(string $value): string
    {
        $tokens = $this->tokenizer->tokenize($value);
        $tree = $this->buildTree($value, $tokens);

        $tokenizedValue = '';
        foreach ($tree as $node) {
            $tokenizedValue .= ($this->tokenizer->isOpeningToken($node))
                ? sprintf('<aliceTokenizedFunction(%s)>', $node)
                : $node
            ;
        }

        return $tokenizedValue;
    }
1252844
static protected function _set_table_rules(\DOMElement $node, $value)
    {
        $new_style = "; border-collapse: collapse;";

        switch ($value) {
            case "none":
                $new_style .= "border-style: none;";
                break;

            case "groups":
                // FIXME: unsupported
                return null;

            case "rows":
                $new_style .= "border-style: solid none solid none; border-width: 1px; ";
                break;

            case "cols":
                $new_style .= "border-style: none solid none solid; border-width: 1px; ";
                break;

            case "all":
                $new_style .= "border-style: solid; border-width: 1px; ";
                break;

            default:
                // Invalid value
                return null;
        }

        $cell_list = self::get_cell_list($node);

        foreach ($cell_list as $cell) {
            $style = $cell->getAttribute(self::$_style_attr);
            $style .= $new_style;
            $cell->setAttribute(self::$_style_attr, $style);
        }

        $style = rtrim($node->getAttribute(self::$_style_attr), ";");
        $style .= "; border-collapse: collapse; ";

        return ltrim($style, "; ");
    }
619059
public function setTarget($key, $value)
    {
        $unit = $this->searchForId($key, true);

        $target = $this->getXPathFirstItem('xliff:target', $unit);

        // If already present check.
        if ($target === null) {
            $target = $unit->appendChild($this->doc->createElementNS(self::NS, 'target'));
        } elseif ($target->firstChild) {
            // If already present, we have to remove the textnode if one exists as otherwise the value will get
            // appended.
            $target->removeChild($target->firstChild);
        }

        $target->appendChild($this->doc->createTextNode($value));
    }
958476
public function canHandle(\DOMNode $node, NodeInterface $target)
    {
        return
            strtolower($node->localName) == 'link' &&
            $node->namespaceURI == Atom10Standard::NAMESPACE_URI &&
            $target instanceof ChannelInterface;
    }
1187153
public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        if (is_array($source)) {
            $result = [];
            /** @var NodeInterface $node */
            foreach ($source as $node) {
                $result[] = $node->getIdentifier();
            }
        } else {
            if ($source instanceof NodeInterface) {
                $result = $source->getIdentifier();
            } else {
                $result = '';
            }
        }

        return $result;
    }
472749
private function dataToArrayNode(\DOMDocument $document, \DOMNode $listNode, $key, array $value)
    {
        if (!isset($value['_type'])) {
            $childNode = $document->createElement(is_int($key) ? Inflector::singularize($listNode->nodeName) : $key);
            $this->dataToNodes($document, $childNode, $value);

            return $childNode;
        }

        if (is_int($key)) {
            $childNode = $this->createMetadataNode($document, $value['_type']);

            unset($value['_type']);

            $this->dataToNodes($document, $childNode, $value);

            return $childNode;
        }

        $subChildNode = $this->createMetadataNode($document, $value['_type']);

        unset($value['_type']);

        $childNode = $document->createElement($key);
        $childNode->appendChild($subChildNode);

        $this->dataToNodes($document, $subChildNode, $value);

        return $childNode;
    }
341815
public function handle(Parser $parser, \DOMNode $node, NodeInterface $target)
    {
        $url = $node->attributes->getNamedItem('href')->nodeValue;
        $type = $node->attributes->getNamedItem('type')->nodeValue;
        $length = intval($node->attributes->getNamedItem('length')->nodeValue, 10);
        $title = $node->attributes->getNamedItem('title') ? $node->attributes->getNamedItem('title')->nodeValue : basename($url);
        $enclosure = new Enclosure();
        $enclosure
            ->setType($type)
            ->setLength($length)
            ->setTitle($title)
            ->setUrl($url);
        /** @var ItemInterface $target */
        $target->addEnclosure($enclosure);
    }
685030
private function handleValue( $value, DOMDocument $domDocument )
    {
        switch ( gettype( $value ) )
        {
            case 'integer':
                $node = $domDocument->createElement( 'int', $value );
                break;

            case 'boolean':
                $node = $domDocument->createElement( 'boolean', $value );
                break;

            case 'string':
                $node = $domDocument->createElement( 'string', $value );
                break;

            case 'double':
                $node = $domDocument->createElement( 'double', $value );
                break;

            case 'array':
                // array
                if ( empty( $value ) || key( $value ) === 0 )
                {
                    $node = $domDocument->createElement( 'array' );
                    $dataNode = $domDocument->createElement( 'data' );
                    $node->appendChild( $dataNode );

                    foreach ( $value as $cell )
                    {
                        $valueNode = $domDocument->createElement( 'value' );
                        $valueNode->appendChild( $this->handleValue( $cell, $domDocument ) );
                        $dataNode->appendChild( $valueNode );
                    }
                }
                // hash
                else
                {
                    $node = $domDocument->createElement( 'struct' );

                    foreach ( $value as $name => $cell )
                    {
                        // //member
                        $memberNode = $domDocument->createElement( 'member' );

                        // //member/name
                        $memberNode->appendChild( $domDocument->createElement( 'name', $name ) );

                        // //member/value
                        $valueNode = $domDocument->createElement( 'value' );
                        $memberNode->appendChild( $valueNode );
                        // //member/value/*
                        $valueNode->appendChild( $this->handleValue( $cell, $domDocument ) );

                        $node->appendChild( $memberNode );
                    }
                }
                break;

            case 'object':
                {
                    // DateTime is okay
                    if ( !$value instanceof DateTime )
                        continue;
                    $node = $domDocument->createElement( 'dateTime.iso8601', $value->format( DateTime::ISO8601 ) );
                }
                break;

            default:
                {
                    throw new \UnexpectedValueException( "Unknown return value type" );
                }
        }

        return $node;
    }
114061
public function getString($command, $target = null, $value = null)
    {
        $result = $this->doExecute($command, $target, $value);

        if (!preg_match('/^OK,/', $result)) {
            throw new Exception("Unexpected response from Selenium server : ".$result);
        }

        return strlen($result) > 3 ? substr($result, 3) : '';
    }
443663
public function canHandle(\DOMNode $node, NodeInterface $target)
    {
        return strtolower($node->nodeName) == 'enclosure' && $target Instanceof ItemInterface;
    }