src/QueryBuilder.php
protected function _whereString($key, $values=[], string $defaultConj='AND'): self
	{
		// Create key/value placeholders
		foreach($this->_where($key, $values) as $f => $val)
		{
			$queryMap = $this->state->getQueryMap();

			// 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]} ?";
			$lastItem = end($queryMap);

			// Determine the correct conjunction
			$conjunctionList = array_column($queryMap, 'conjunction');
			if (empty($queryMap) || ( ! \regexInArray($conjunctionList, "/^ ?\n?WHERE/i")))
			{
				$conj = "\nWHERE ";
			}
			elseif ($lastItem['type'] === 'group_start')
			{
				$conj = '';
			}
			else
			{
				$conj = " {$defaultConj} ";
			}

			$this->state->appendMap($conj, $item, 'where');
		}

		return $this;
	}
protected function _whereString($key, $values=[], string $defaultConj='AND'): self
	{
		// Create key/value placeholders
		foreach($this->_where($key, $values) as $f => $val)
		{
			$queryMap = $this->state->getQueryMap();

			// 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]} ?";
			$lastItem = end($queryMap);

			// Determine the correct conjunction
			$conjunctionList = array_column($queryMap, 'conjunction');
			if (empty($queryMap) || ( ! \regexInArray($conjunctionList, "/^ ?\n?WHERE/i")))
			{
				$conj = "\nWHERE ";
			}
			elseif ($lastItem['type'] === 'group_start')
			{
				$conj = '';
			}
			else
			{
				$conj = " {$defaultConj} ";
			}

			$this->state->appendMap($conj, $item, 'where');
		}

		return $this;
	}
protected function _whereString ( $ key , $ values = [ ] , string $ defaultConj = 'AND' ) : self { // Create key/value placeholders foreach ( $ this -> _where ( $ key , $ values ) as $ f => $ val ) { $ queryMap = $ this -> state -> getQueryMap ( ) ; // 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]} ?" ; $ lastItem = end ( $ queryMap ) ; // Determine the correct conjunction $ conjunctionList = array_column ( $ queryMap , 'conjunction' ) ; if ( empty ( $ queryMap ) || ( ! \ regexInArray ( $ conjunctionList , "/^ ?\n?WHERE/i" ) ) ) { $ conj = "\nWHERE " ; } elseif ( $ lastItem [ 'type' ] === 'group_start' ) { $ conj = '' ; } else { $ conj = " {$defaultConj} " ; } $ this -> state -> appendMap ( $ conj , $ item , 'where' ) ; } return $ this ; }
Simplify generating where string

@param mixed $key
@param mixed $values
@param string $defaultConj
@return self
Simplify generating where string