FilterChain: add and use count() function

This commit is contained in:
Thomas Gelf 2014-11-15 22:34:18 +01:00
parent 39d7d13ddb
commit 1f74c462d4
1 changed files with 6 additions and 1 deletions

View File

@ -184,7 +184,7 @@ abstract class FilterChain extends Filter
public function addFilter(Filter $filter) public function addFilter(Filter $filter)
{ {
$this->filters[] = $filter; $this->filters[] = $filter;
$filter->setId($this->getId() . '-' . (count($this->filters))); $filter->setId($this->getId() . '-' . $this->count());
} }
public function &filters() public function &filters()
@ -192,6 +192,11 @@ abstract class FilterChain extends Filter
return $this->filters; return $this->filters;
} }
public function count()
{
return count($this->filters);
}
public function __clone() public function __clone()
{ {
foreach ($this->filters as & $filter) { foreach ($this->filters as & $filter) {