Exemple #1
0
 /**
  * @param string|Zend_Db_Expr $expr
  * @param bool $distinct
  * @param null|string &$bindAs
  * @return $this
  */
 public function maxSet($expr, $distinct = false, &$bindAs = null)
 {
     $exprCopy = $expr;
     if (true === $this->prefixColumn($this, $expr)) {
         $bindAs = $exprCopy;
     }
     $expr = (string) $expr;
     if ($distinct) {
         $expr = str_prepend('DISTINCT ', $expr);
     }
     $expr = 'MAX(' . $expr . ')';
     return $this->setColumns($bindAs === null ? $expr : "{$expr} AS {$bindAs}", $this->getAlias());
 }
Exemple #2
0
 /**
  * @param string|callable $what
  * @param string|callable|null $string
  * @return callable
  */
 function str_prepend_dg($what, $string = null)
 {
     if (!is_callable($what)) {
         $what = return_dg($what);
     }
     if (is_null($string)) {
         $string = tuple_get(0);
     } elseif (!is_callable($string)) {
         $string = return_dg($string);
     }
     return function () use($what, $string) {
         $args = func_get_args();
         return str_prepend(call_user_func_array($string, $args), call_user_func_array($what, $args));
     };
 }