Whups_Query::insertCriterion PHP Method

insertCriterion() public method

public insertCriterion ( $pathstring, $criterion, $cvalue, $operator, $value )
    public function insertCriterion($pathstring, $criterion, $cvalue, $operator, $value)
    {
        $path = Whups_Query::stringToPath($pathstring);
        $qobj =& $this->query;
        $value = trim($value);
        if ($value[0] == '"') {
            // FIXME: The last character should be '"' as well.
            $value = substr($value, 1, -1);
        } else {
            $pn = $this->_getParameterName($value);
            if ($pn !== null) {
                $this->parameters[] = $pn;
            }
        }
        $newbranch = array('type' => Whups_Query::TYPE_CRITERION, 'criterion' => $criterion, 'cvalue' => $cvalue, 'operator' => $operator, 'value' => $value);
        $count = count($path);
        for ($i = 0; $i < $count; $i++) {
            $qobj =& $qobj['children'][$path[$i]];
        }
        $qobj['children'][] = $newbranch;
    }