1
0
mirror of synced 2025-01-19 06:51:40 +03:00

Merge pull request #137 from docteurklein/fluent_query_expr

added fluent pattern to Query\Expr\Base::add* methods
This commit is contained in:
Benjamin Eberlei 2011-10-15 11:09:37 -07:00
commit 18fd29613c

View File

@ -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;
} }
} }