Adds data to any paths that require it

@param resource $parser
@param string   $data

@return NULL
559784
protected function addData($parser, $data)
    {
        //Having a path data entry means at least 1 callback is interested in
        //the data. Loop through each path here and, if inside that path, add
        //the data
        foreach ($this->pathData as $key => $val) {
            if (strpos($this->currentPath, $key) !== FALSE) {
                $this->pathData[$key] .= $data;
            }
        }

        return $parser;
    }
1287465
protected function addData($key, $data = null)
    {
        $this->data[self::RS_KEY_DATA]->{$key} = $data;
    }
653939
private function addSrc($phar)
    {
        if (file_exists($this->path . '/src')) {
            $src = new Finder();
            $src->files()->ignoreVCS(true)->ignoreDotFiles(true)->name('*.php')->notName('Compiler.php')->notName('Composer.php')->in($this->path . '/src');

            foreach ($src as $file) {
                $this->addFile($phar, $file);
            }
        }
    }
193659
public function feed(ParserFactory $parser, DOMElement $data, QtiNamespace $xmlns = null){

        $this->setNamespace($xmlns);
        $xmlnsName = $xmlns->getName();

        $pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $xmlnsName);
        if(!$pciNodes->length) {
            $xmlnsName = '';//even if a namespace has been defined, it may not be used
            $pciNodes = $parser->queryXPathChildren(array('portableCustomInteraction'), $data, $xmlnsName);
        }
        if(!$pciNodes->length) {
            throw new QtiModelException('no ims portableCustomInteraction node found');
        }

        $typeIdentifier = $pciNodes->item(0)->getAttribute('customInteractionTypeIdentifier');
        if(empty($typeIdentifier)){
            throw new QtiModelException('the type identifier of the pci is missing');
        }else{
            $this->setTypeIdentifier($typeIdentifier);
        }

        $version = $pciNodes->item(0)->getAttribute('data-version');
        if($version){
            $this->setVersion($version);
        }

        $rootModulesNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'modules'), $data, $xmlnsName);
        foreach($rootModulesNodes as $rootModulesNode){
            $config = [];
            if($rootModulesNode->getAttribute('primaryConfiguration')){
                $config[] = $rootModulesNode->getAttribute('primaryConfiguration');
            }
            if($rootModulesNode->getAttribute('fallbackConfiguration')){
                $config[] = $rootModulesNode->getAttribute('fallbackConfiguration');
            }
            $this->setConfig($config);
        }

        $moduleNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'modules', 'module'), $data, $xmlnsName);
        foreach($moduleNodes as $libNode){
            $id = $libNode->getAttribute('id');
            $paths = [];
            if($libNode->getAttribute('primaryPath')){
                $paths[] = $libNode->getAttribute('primaryPath');
            }
            if($libNode->getAttribute('fallbackPath')){
                $paths[] = $libNode->getAttribute('fallbackPath');
            }
            $this->addModule($id, $paths);
        }

        $propertyNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'properties'), $data, $xmlnsName);
        if($propertyNodes->length){
            $properties = $this->extractProperties($propertyNodes->item(0), $xmlnsName);
            $this->setProperties($properties);
        }

        $markupNodes = $parser->queryXPathChildren(array('portableCustomInteraction', 'markup'), $data, $xmlnsName);
        if($markupNodes->length){
            $markup = $parser->getBodyData($markupNodes->item(0), true, true);
            $this->setMarkup($markup);
        }
    }
966095
public static function setByPath(&$data, string $path, $value, string $separator = '.'): void
    {
        if (false === \strpos($path, $separator)) {
            $data[$path] = $value;
            return;
        }

        if (!$nodes = \array_filter(\explode($separator, $path))) {
            return;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (\is_array($dataTmp)) {
                if (empty($dataTmp[$node])) {
                    $dataTmp[$node] = [];
                }

                $dataTmp = &$dataTmp[$node];
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = [];
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;
    }
1048389
public function parse(Parser $parser)
    {
        $parser->match(Lexer::T_IDENTIFIER);
        $parser->match(Lexer::T_OPEN_PARENTHESIS);

        $this->maskField = $parser->ArithmeticPrimary();
        $this->deleteDeferredPath($parser, $this->maskField);

        $parser->match(Lexer::T_COMMA);
        $this->findValue = $parser->ArithmeticPrimary();

        $parser->match(Lexer::T_CLOSE_PARENTHESIS);
        $this->parserResult = $parser->getParserResult();
    }
517011
private function characterdata($parser, $data) {
        $current = &$this->current;
        $level = &$this->level;
        if (($data == "0") || (!empty($data) && trim($data) != "")) {
            $siz = count($current[$level]);
            if ($siz == 0) {
                $current[$level][0] = $data;
            } else {
                $key = max(array_keys($current[$level]));
                if (is_int($key)) {
                    end($current[$level]);
                    if (is_int(key($current[$level]))) { // If last index is nummeric we have CDATA and concat.
                        $current[$level][$key] = $current[$level][$key] . $data;
                    } else {
                        $current[$level][$key + 1] = $data; // Otherwise we make a new key.
                    }
                } else {
                    $current[$level][0] = $data;
                }
            }
        }
    }
365569
public function addParser($mediaType, Parser $parser)
    {
        list($mediaType, $version) = $this->parseMediaTypeVersion($mediaType);
        $this->parsers[$mediaType][$version] = $parser;
    }
671259
private function addPostData($Resource, $data) {
        if (!empty($data)) {
            switch ($this->Request->getContentTypeCode()) {
                case Request::CONTENT_TYPE_UNDEFINED:
                    $string = http_build_query($data);
                    break;
                case Request::CONTENT_TYPE_JSON:
                    $string = json_encode($data);
                    break;
                case Request::CONTENT_TYPE_TEXT:
                    $string = (string) $data;
                    break;
                case Request::CONTENT_TYPE_XML:
                    if ($data instanceof DOMDocument) {
                        $string = $data->saveXML();
                    } else {
                        $string = (string) $data;
                    }
                    break;
                default:
                    throw new HttpContentTypeException();
            }
            curl_setopt_array($Resource, array(
                CURLOPT_POST    => true,
                CURLOPT_POSTFIELDS => $string,
            ));
        }
    }
685044
public function put($url, $data = '$undefined')
    {
        if ($data === '$undefined') {
            $data = ($url instanceof Resource)
                ? $url->data()
                : null;
        }
        return $this->request('put', $url, $data);
    }
1269721
public function charXML($parser, $data) {
		if(array_key_exists($this->xml_depth, $this->xmlobj)) {
			$this->xmlobj[$this->xml_depth]->data .= $data;
		}
	}
35868
public function character_data($parser, $data)
    {
        $pos = isset($this->depth_array[$this->depth]) ? $this->depth_array[$this->depth] : 0;
        if (isset($this->message[$pos]['cdata'])) {
            $this->message[$pos]['cdata'] .= $data;
        }
        if ($this->documentation) {
            $this->documentation .= $data;
        }
    }
177911
public static function setByPath(array &$data, $path, $value, $separator = '.')
    {
        $nodes = array_values(explode($separator, $path));

        if (empty($nodes)) {
            return false;
        }

        $dataTmp = &$data;

        foreach ($nodes as $node) {
            if (is_array($dataTmp)) {
                if ((string) $node === '') {
                    $tmp = [];
                    $dataTmp[] = &$tmp;
                    $dataTmp = &$tmp;
                } else {
                    if (empty($dataTmp[$node])) {
                        $dataTmp[$node] = [];
                    }

                    $dataTmp = &$dataTmp[$node];
                }
            } else {
                // If a node is value but path is not go to the end, we replace this value as a new store.
                // Then next node can insert new value to this store.
                $dataTmp = &$value;
            }
        }

        // Now, path go to the end, means we get latest node, set value to this node.
        $dataTmp = $value;

        return true;
    }
204318
public static function install(Compiler $parser) {
		$me = new static($parser);
		$callback = array($me, 'macroGettext');
		$me->addMacro('_', $callback);
		$me->addMacro('_n', $callback);
		$me->addMacro('_p', $callback);
		$me->addMacro('_np', $callback);
	}
260249
private function addTpl($phar)
    {
        $json = new Finder();
        $json->files()->ignoreVCS(true)->ignoreDotFiles(true)->name('*.tpl.json')->in($this->path . '/tpl');

        foreach ($json as $file) {
            $this->addFile($phar, $file, false);
        }

        $php = new Finder();
        $php->files()->ignoreVCS(true)->ignoreDotFiles(true)->name('*.php')->in($this->path . '/tpl');

        foreach ($php as $file) {
            $this->addFile($phar, $file);
        }
    }
566425
private function getParsedData()
    {
        if (is_array($this->parsedData)) {
            return $this->parsedData;
        }

        $this->parsedData = [
            'routes' => []
        ];

        $content = $this->getYmlFileContent();
        try {
            $parsedData = $this->parser->parse($content);
            $this->addGeneralDefaults($parsedData);
            $this->addDataRoutes($parsedData);
        } catch (ParseException $caught) {
            throw new RoutesFileParserException(
                $caught->getMessage(),
                0,
                $caught
            );
        }
        return $this->parsedData;
    }
143069
public function addData($data) {
        if (\is_string($data)) {
            $this->addDataSql($data);
        } elseif (\is_array($data)) {
            $this->addDataArray($data);
        } elseif (\is_object($data)) {
            $this->addDataObjectCollection($data);
        } elseif (\is_resource($data)) {
            $this->addDataQueryResource($data);
        } else {
            throw new InvalidArgumentException('Unsupported data type.');
        }
        return $this;
    }