/** * Adds an or where clause to the current query. * * @param string $field * @param string|null $operator * @param string|null $value * * @return Builder */ public function orWhere($field, $operator = null, $value = null) { $this->orWheres[] = [self::$whereFieldKey => $field, self::$whereOperatorKey => $this->getOperator($operator), self::$whereValueKey => Utilities::escape($value)]; return $this; }
/** * Adds the inserted field, operator and value * to the orWheres property array. * * @param string $field * @param string $operator * @param null $value * * @throws InvalidQueryOperatorException */ private function addOrWhere($field, $operator, $value = null) { $this->orWheres[] = [self::$whereFieldKey => $field, self::$whereOperatorKey => $this->getOperator($operator), self::$whereValueKey => Utilities::escape($value)]; }
/** * Adds a binding to the query. * * @param string $field * @param string $operator * @param string $value * @param string $type * * @throws InvalidQueryOperatorException * * @return Builder */ public function addBinding($field, $operator, $value, $type = 'where') { if (!array_key_exists($type, $this->bindings)) { throw new InvalidArgumentException("Invalid binding type: {$type}."); } $operator = $this->getOperator($operator); $value = Utilities::escape($value); $this->{$this->bindings[$type]}[] = compact('field', 'operator', 'value'); return $this; }
/** * Assembles an RDN with the specified attribute and value. * * @param string $attribute * @param array $values * * @return null|string */ private function assembleRdns($attribute, array $values = []) { if (count($values) > 0) { $values = array_reverse($values); $values = array_map(function ($value) use($attribute) { return $attribute . '=' . Utilities::escape($value, '', 2); }, $values); return implode(',', $values); } return null; }
/** * Assembles an RDN with the specified attribute and value. * * @param string $attribute * @param array $values * * @return null|string */ protected function assembleRdns($attribute, array $values = []) { if (count($values) > 0) { $values = array_reverse($values); $values = array_map(function ($value) use($attribute) { return sprintf('%s=%s', $attribute, Utilities::escape($value, '', 2)); }, $values); return implode(',', $values); } return; }