private function parseAnalyzers(
        \DOMXPath $xpath,
        array $availableCharFilters,
        array $availableFilters,
        $language = 'default'
    ) {
        $analyzers = [];

        $languagePath = "@language='default'";

        if ($language != 'default') {
            $languagePath .= " or @language='{$language}'";
        }

        $searchPath = sprintf(
            '/%s/%s/%s[%s]',
            self::ROOT_NODE_NAME,
            self::ANALYZER_TYPE_ROOT_NODE,
            self::ANALYZER_TYPE_NODE,
            $languagePath
        );

        $analyzerNodes = $xpath->query($searchPath);

        foreach ($analyzerNodes as $analyzerNode) {
            $analyzerName = $analyzerNode->getAttribute('name');
            $analyzer = ['tokenizer' => $analyzerNode->getAttribute('tokenizer'), 'type' => 'custom'];
            $analyzers[$analyzerName] = $analyzer;

            $filterPath = sprintf('%s/%s', self::FILTER_TYPE_ROOT_NODE, self::FILTER_TYPE_NODE);
            $analyzer[self::FILTER_TYPE_NODE] = $this->getFiltersByRef(
                $xpath,
                $analyzerNode,
                $filterPath,
                $availableFilters
            );

            $charFilterPath = sprintf('%s/%s', self::CHAR_FILTER_TYPE_ROOT_NODE, self::CHAR_FILTER_TYPE_NODE);
            $analyzer[self::CHAR_FILTER_TYPE_NODE] = $this->getFiltersByRef(
                $xpath,
                $analyzerNode,
                $charFilterPath,
                $availableCharFilters
            );

            $analyzers[$analyzerName] = $analyzer;
        }

        return $analyzers;
    }
private function parseAnalyzers(
        \DOMXPath $xpath,
        array $availableCharFilters,
        array $availableFilters,
        $language = 'default'
    ) {
        $analyzers = [];

        $languagePath = "@language='default'";

        if ($language != 'default') {
            $languagePath .= " or @language='{$language}'";
        }

        $searchPath = sprintf(
            '/%s/%s/%s[%s]',
            self::ROOT_NODE_NAME,
            self::ANALYZER_TYPE_ROOT_NODE,
            self::ANALYZER_TYPE_NODE,
            $languagePath
        );

        $analyzerNodes = $xpath->query($searchPath);

        foreach ($analyzerNodes as $analyzerNode) {
            $analyzerName = $analyzerNode->getAttribute('name');
            $analyzer = ['tokenizer' => $analyzerNode->getAttribute('tokenizer'), 'type' => 'custom'];
            $analyzers[$analyzerName] = $analyzer;

            $filterPath = sprintf('%s/%s', self::FILTER_TYPE_ROOT_NODE, self::FILTER_TYPE_NODE);
            $analyzer[self::FILTER_TYPE_NODE] = $this->getFiltersByRef(
                $xpath,
                $analyzerNode,
                $filterPath,
                $availableFilters
            );

            $charFilterPath = sprintf('%s/%s', self::CHAR_FILTER_TYPE_ROOT_NODE, self::CHAR_FILTER_TYPE_NODE);
            $analyzer[self::CHAR_FILTER_TYPE_NODE] = $this->getFiltersByRef(
                $xpath,
                $analyzerNode,
                $charFilterPath,
                $availableCharFilters
            );

            $analyzers[$analyzerName] = $analyzer;
        }

        return $analyzers;
    }
private function parseAnalyzers ( \ DOMXPath $ xpath , array $ availableCharFilters , array $ availableFilters , $ language = 'default' ) { $ analyzers = [ ] ; $ languagePath = "@language='default'" ; if ( $ language != 'default' ) { $ languagePath .= " or @language='{$language}'" ; } $ searchPath = sprintf ( '/%s/%s/%s[%s]' , self :: ROOT_NODE_NAME , self :: ANALYZER_TYPE_ROOT_NODE , self :: ANALYZER_TYPE_NODE , $ languagePath ) ; $ analyzerNodes = $ xpath -> query ( $ searchPath ) ; foreach ( $ analyzerNodes as $ analyzerNode ) { $ analyzerName = $ analyzerNode -> getAttribute ( 'name' ) ; $ analyzer = [ 'tokenizer' => $ analyzerNode -> getAttribute ( 'tokenizer' ) , 'type' => 'custom' ] ; $ analyzers [ $ analyzerName ] = $ analyzer ; $ filterPath = sprintf ( '%s/%s' , self :: FILTER_TYPE_ROOT_NODE , self :: FILTER_TYPE_NODE ) ; $ analyzer [ self :: FILTER_TYPE_NODE ] = $ this -> getFiltersByRef ( $ xpath , $ analyzerNode , $ filterPath , $ availableFilters ) ; $ charFilterPath = sprintf ( '%s/%s' , self :: CHAR_FILTER_TYPE_ROOT_NODE , self :: CHAR_FILTER_TYPE_NODE ) ; $ analyzer [ self :: CHAR_FILTER_TYPE_NODE ] = $ this -> getFiltersByRef ( $ xpath , $ analyzerNode , $ charFilterPath , $ availableCharFilters ) ; $ analyzers [ $ analyzerName ] = $ analyzer ; } return $ analyzers ; }
Analyzers parser by language.

@param \DOMXPath $xpath                XPath access to the document parsed.
@param array     $availableCharFilters List of available char filters.
@param array     $availableFilters     List of available filters.
@param string    $language             Language searched.

@return array
Analyzers parser by language .