Pheasant\Query\Criteria::__construct PHP Method

__construct() public method

Constructor
public __construct ( $where = null, $params = [] )
$where either a query string, or a key=>val array
$params mixed, parameters to bind into the query string
    public function __construct($where = null, $params = array())
    {
        if (is_object($where)) {
            $this->_sql = $where->toSql(false);
        } elseif (is_array($where)) {
            $conditions = array();
            foreach ($where as $key => $val) {
                $conditions[] = $this->bind('`' . $key . '`' . '=?', array($val));
            }
            $this->_sql = implode(' AND ', $conditions);
        } elseif (!empty($where)) {
            $this->_sql = $this->bind($where, (array) $params);
        }
    }