Checks the existence of the node.

@param string $expression XPath expression or CSS selector
@param string $type The type of the expression

@return bool
196193
public function has($expression, $type = Query::TYPE_CSS)
    {
        return $this->toDocument()->has($expression, $type);
    }
1298669
public boolean isIndexed(String expression) {
    if (expression == null || expression.length() == 0) { return false; }
    for (int i = 0; i < expression.length(); i++) {
      char c = expression.charAt(i);
      if (c == Nested || c == MappedStart) {
        return false;
      } else if (c == IndexedStart) { return true; }
    }
    return false;
  }
195659
public function lookaheadTypeIs(int $type): bool
    {
        return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEquals($type);
    }
1061935
public static function isValid($expression, $translate = false)
    {
        if ($translate) {
            $expression = self::translate($expression);
        }

        return is_bool($expression);
    }
363494
public function exists($css_selector) {
		$xpath_selector	= $this->_css_toxpath_selector($css_selector);
		$nodelist		= $this->xpath->query($xpath_selector);
		if ($nodelist->item(0) === null) return false;
		return true;
	}
134045
function matches($expression)
    {
        $parts = explode('.', $expression);

        // Defer evaluation of next expression to loop node.
        if (isset($parts[1])) {
            return ($this->loopNode->matches($parts[1]));
        }

        // Next expression is empty, hence it matches.
        return true;
    }
530511
public function is(string $path, string $type = 'page'): ?string
  {
    return $this->from_path($path, $type);
  }
1018751
private function allowedTypeExist(string $type):bool
    {
        foreach ($this->allowed_text_render as $one) {
            if ($one["type"] === $type) {
                return (true);
            }
        }
        return (false);
    }
878727
public function isTextValid(string $text): bool
    {
        $parser = new Node_Container_Document();

        if ($this->configData['emoticons']['active']) {
            $parser->add_emoticons($this->configData['emoticons']['path']);
        }

        $this->errorText = '';
        $result = true;
        try {
            $parser->parse($text)
                ->detect_links()
                ->detect_emails();

            if ($this->configData['emoticons']['active']) {
                $parser->detect_emoticons();
            }

            $parser->get_html();

        } catch (\Exception $e) {
            $result = false;
            $this->errorText = $e->getMessage();
        } catch (\Throwable $e) {
            $result = false;
            $this->errorText = $e->getMessage();
        }

        return $result;
    }
965574
public function xpathQuery(string $expression, \DOMNode $context_node=null)
    {
        if ($this->dom_xpath) {
            $node_list = $this->dom_xpath->query($expression, $context_node);

            if ($node_list instanceof \DOMNodeList) {
                return $node_list;
            } elseif ($node_list === false && $context_node) {
                throw new \Exception('Expression '.$expression.' is malformed or contextnode is invalid.');
            } elseif ($node_list === false) {
                throw new \Exception('Expression '.$expression.' is malformed.');
            }
        }

        return false;
    }
660534
public function find($expression)
    {
        $xpath = new Dom\XPath($this);

        $xpath->registerNamespace("php", "http://php.net/xpath");
        $xpath->registerPhpFunctions();

        return $xpath->query($expression);
    }
366717
public function whereElemNotMatch($field, $expression)
    {
        return $this->whereNot($this->expression()->whereElemMatch($field, $expression));
    }
988346
public function match($expression)
    {
        if (is_callable($expression)) {
            $expressionConfigurator = $expression;
            $expression = new Expression();
            call_user_func($expressionConfigurator, $expression);
        }

        if ($expression instanceof Expression) {
            $expression = $expression->toArray();
        } elseif (!is_array($expression)) {
            throw new Exception('Must be array, callable or instance of \Sokil\Mongo\Expression');
        }

        $this->addStage('$match', $expression);
        return $this;
    }
533912
public function hasFinder($type)
    {
        $finder = 'find' . $type;

        return method_exists($this, $finder) || ($this->_behaviors && $this->_behaviors->hasFinder($type));
    }
106893
public function has($type)
    {
        if (!isset($this->checkers[$type])) {
            return false;
        }

        return $this->container->has($this->checkers[$type]);
    }
843691
protected function convertToString($type, $expression)
	{
		switch($type)
		{
			case Type::STRING:
			case Type::TEXT:
				return $expression;
			case Type::BIGINT:
			case Type::DECIMAL:
			case Type::FLOAT:
			case Type::INTEGER:
			case Type::SMALLINT:
			case Type::DATE:
			case Type::DATETIME:
			case Type::DATETIMETZ:
			case Type::TIME:
				return 'CAST(' . $expression . ' AS CHAR)';
			default :
				return '\'\'';
		}
	}
1245203
private function typeExists(string $schema, string $typeName) : bool
    {
        if (!$this->schemaExists($schema)) {
            return false;
        }

        return array_key_exists($typeName, $this->storage[$schema]);
    }