src/QueryBuilder.php
protected function _having($key, $values=[], string $conj='AND'): self
	{
		$where = $this->_where($key, $values);

		// Create key/value placeholders
		foreach($where as $f => $val)
		{
			// Split each key by spaces, in case there
			// is an operator such as >, <, !=, etc.
			$fArray = explode(' ', trim($f));

			$item = $this->driver->quoteIdent($fArray[0]);

			// Simple key value, or an operator
			$item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?";

			// Put in the having map
			$this->state->appendHavingMap([
				'conjunction' => empty($this->state->getHavingMap())
					? ' HAVING '
					: " {$conj} ",
				'string' => $item
			]);
		}

		return $this;
	}
protected function _having($key, $values=[], string $conj='AND'): self
	{
		$where = $this->_where($key, $values);

		// Create key/value placeholders
		foreach($where as $f => $val)
		{
			// Split each key by spaces, in case there
			// is an operator such as >, <, !=, etc.
			$fArray = explode(' ', trim($f));

			$item = $this->driver->quoteIdent($fArray[0]);

			// Simple key value, or an operator
			$item .= (count($fArray) === 1) ? '=?' : " {$fArray[1]} ?";

			// Put in the having map
			$this->state->appendHavingMap([
				'conjunction' => empty($this->state->getHavingMap())
					? ' HAVING '
					: " {$conj} ",
				'string' => $item
			]);
		}

		return $this;
	}
protected function _having ( $ key , $ values = [ ] , string $ conj = 'AND' ) : self { $ where = $ this -> _where ( $ key , $ values ) ; // Create key/value placeholders foreach ( $ where as $ f => $ val ) { // Split each key by spaces, in case there // is an operator such as >, <, !=, etc. $ fArray = explode ( ' ' , trim ( $ f ) ) ; $ item = $ this -> driver -> quoteIdent ( $ fArray [ 0 ] ) ; // Simple key value, or an operator $ item .= ( count ( $ fArray ) === 1 ) ? '=?' : " {$fArray[1]} ?" ; // Put in the having map $ this -> state -> appendHavingMap ( [ 'conjunction' => empty ( $ this -> state -> getHavingMap ( ) ) ? ' HAVING ' : " {$conj} " , 'string' => $ item ] ) ; } return $ this ; }
Simplify building having clauses

@param mixed $key
@param mixed $values
@param string $conj
@return self
Simplify building having clauses