Habari\QueryWhere::get PHP Method

get() public method

Obtain the where clause as a string to use in a query
public get ( integer $level ) : string
$level integer Used internally to retain indenting
return string The where clause represented by this object
    public function get($level = 0)
    {
        $outputs = array();
        $indents = str_repeat("\t", $level);
        if (count($this->expressions) == 0) {
            return null;
        }
        foreach ($this->expressions as $expression) {
            if ($expression instanceof Query) {
                $outputs[] = $expression->get();
            }
            if ($expression instanceof QueryWhere) {
                $outputs[] = $expression->get($level + 1);
            } else {
                $outputs[] = $indents . "\t" . $expression;
            }
        }
        $outputs = array_filter($outputs);
        $output = implode("\n" . $indents . $this->operator . "\n", $outputs);
        if ($level == 0) {
            return $output;
        }
        return $indents . "(\n" . $output . "\n" . $indents . ")";
    }