[icinga-checkins] icinga.org: icingaweb2/master: FilterChain: add and use count() function

git at icinga.org git at icinga.org
Sun Nov 16 00:38:40 CET 2014


Module: icingaweb2
Branch: master
Commit: 1f74c462d471596d29b09d07996d384153f7ae8e
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=1f74c462d471596d29b09d07996d384153f7ae8e

Author: Thomas Gelf <thomas at gelf.net>
Date:   Sat Nov 15 22:34:18 2014 +0100

FilterChain: add and use count() function

---

 library/Icinga/Data/Filter/FilterChain.php |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/library/Icinga/Data/Filter/FilterChain.php b/library/Icinga/Data/Filter/FilterChain.php
index c7697b7..e86f6fe 100644
--- a/library/Icinga/Data/Filter/FilterChain.php
+++ b/library/Icinga/Data/Filter/FilterChain.php
@@ -184,7 +184,7 @@ abstract class FilterChain extends Filter
     public function addFilter(Filter $filter)
     {
         $this->filters[] = $filter;
-        $filter->setId($this->getId() . '-' . (count($this->filters)));
+        $filter->setId($this->getId() . '-' . $this->count());
     }
 
     public function &filters()
@@ -192,6 +192,11 @@ abstract class FilterChain extends Filter
         return $this->filters;
     }
 
+    public function count()
+    {
+        return count($this->filters);
+    }
+
     public function __clone()
     {
         foreach ($this->filters as & $filter) {



More information about the icinga-checkins mailing list