public function setSource($key, $value)
    {
        $unit = $this->searchForId($key, true);

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

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

        $source->appendChild($this->doc->createTextNode($value));
    }
public function setSource($key, $value)
    {
        $unit = $this->searchForId($key, true);

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

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

        $source->appendChild($this->doc->createTextNode($value));
    }
public function setSource ( $ key , $ value ) { $ unit = $ this -> searchForId ( $ key , true ) ; $ source = $ this -> getXPathFirstItem ( 'xliff:source' , $ unit ) ; // If already present check if ( $ source === null ) { $ source = $ unit -> appendChild ( $ this -> doc -> createElementNS ( self :: NS , 'source' ) ) ; } elseif ( $ source -> firstChild ) { // If already present, we have to remove the textnode if one exists as otherwise the value will get // appended. $ source -> removeChild ( $ source -> firstChild ) ; } $ source -> appendChild ( $ this -> doc -> createTextNode ( $ value ) ) ; }
Sets the source value for the given key to the given value.

@param string $key   The key for the translation string.

@param string $value The value to use.

@return void
Sets the source value for the given key to the given value .