Merge pull request #137 from docteurklein/fluent_query_expr
added fluent pattern to Query\Expr\Base::add* methods
This commit is contained in:
commit
18fd29613c
@ -45,12 +45,14 @@ abstract class Base
|
|||||||
{
|
{
|
||||||
$this->addMultiple($args);
|
$this->addMultiple($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addMultiple($args = array())
|
public function addMultiple($args = array())
|
||||||
{
|
{
|
||||||
foreach ((array) $args as $arg) {
|
foreach ((array) $args as $arg) {
|
||||||
$this->add($arg);
|
$this->add($arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add($arg)
|
public function add($arg)
|
||||||
@ -67,6 +69,8 @@ abstract class Base
|
|||||||
|
|
||||||
$this->_parts[] = $arg;
|
$this->_parts[] = $arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function count()
|
public function count()
|
||||||
@ -79,7 +83,7 @@ abstract class Base
|
|||||||
if ($this->count() == 1) {
|
if ($this->count() == 1) {
|
||||||
return (string) $this->_parts[0];
|
return (string) $this->_parts[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_preSeparator . implode($this->_separator, $this->_parts) . $this->_postSeparator;
|
return $this->_preSeparator . implode($this->_separator, $this->_parts) . $this->_postSeparator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user