FluentDOM\Nodes::prepareFindContext PHP Méthode

prepareFindContext() private méthode

private prepareFindContext ( mixed $selector, integer $options ) : array
$selector mixed
$options integer
Résultat array
    private function prepareFindContext($selector, $options)
    {
        $useDocumentContext = $this->_useDocumentContext || ($options & self::CONTEXT_DOCUMENT) === self::CONTEXT_DOCUMENT;
        $selectorIsScalar = is_scalar($selector) || NULL === $selector;
        $selectorIsFilter = $selectorIsScalar && ($options & self::FIND_MODE_FILTER) === self::FIND_MODE_FILTER;
        if ($useDocumentContext) {
            $expression = $selectorIsFilter ? '//*' : '//*|//text()';
            $contextMode = self::CONTEXT_DOCUMENT;
            $fetchOptions = Nodes\Fetcher::IGNORE_CONTEXT;
        } else {
            $expression = $selectorIsFilter ? './/*' : './/*|.//text()';
            $contextMode = self::CONTEXT_CHILDREN;
            $fetchOptions = Nodes\Fetcher::UNIQUE;
        }
        if (($options & self::FIND_FORCE_SORT) === self::FIND_FORCE_SORT) {
            $fetchOptions |= Nodes\Fetcher::FORCE_SORT;
            return array($selectorIsScalar, $selectorIsFilter, $expression, $contextMode, $fetchOptions);
        }
        return array($selectorIsScalar, $selectorIsFilter, $expression, $contextMode, $fetchOptions);
    }