/**
* Assembles a single where query based
* on its operator and returns it.
*
* @param Where $where
*
* @return string|null
*/
protected function compileWhere(Where $where)
{
// The compile function prefix.
$prefix = 'compile';
// Get the operator from the where.
$operator = $where->getOperator();
// Get the name of the operator.
$name = array_search($operator, Operator::all());
if ($name !== false) {
// If the name was found we'll camel case it
// to run it through the compile method.
$method = $prefix . ucfirst($name);
// Make sure the compile method exists for the operator.
if (method_exists($this, $method)) {
return $this->{$method}($where->getField(), $where->getValue());
}
}
return;
}