From: Michael Wallner Date: Wed, 15 Oct 2014 15:22:58 +0000 (+0200) Subject: simplify X-Git-Tag: v2.0.0~1 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fpq-gateway;a=commitdiff_plain;h=81ec79d85ff8d9254a4bf0ffa534a11f4603d60b simplify --- diff --git a/lib/pq/Query/Expr.php b/lib/pq/Query/Expr.php index 0f3d86e..31e8c96 100644 --- a/lib/pq/Query/Expr.php +++ b/lib/pq/Query/Expr.php @@ -18,7 +18,7 @@ class Expr * @param string $e the expression or a format string followed by arguments * @param string ... */ - function __construct($e, $arg = null) { + function __construct($e) { if (func_num_args() > 1) { $e = call_user_func_array("sprintf", func_get_args()); } @@ -52,11 +52,14 @@ class Expr * @throws \UnexpectedValueException if any expr is NULL */ function add(Expr $next) { - if ($this->isNull() || $next->isNull()) { + if ($this->isNull()) { throw new \UnexpectedValueException("Cannot add anything to NULL"); } - for ($that = $this; $that->next; $that = $that->next); - $that->next = $next; + if ($this->next) { + $this->next->add($next); + } else { + $this->next = $next; + } return $this; } }