Permalink
Browse files

updating Filter to allow for multiple filters to be given at once

  • Loading branch information...
1 parent b728db3 commit 56b40a832a82acaeafefac6199582f9f7a9147a8 Chris Cornutt committed Aug 10, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 Shield/Filter.php
View
@@ -29,12 +29,20 @@ public function __construct()
*
* @return null
*/
- public function add($name, $type)
+ public function add($name, $type = null)
{
- if (isset($this->filters[$name])) {
- $this->filters[$name][] = $type;
- } else {
- $this->filters[$name] = array($type);
+ if (!is_array($name)) {
+ $name = array($name => $type);
+ }
+
+ foreach ($name as $n => $type) {
+ if ($type == null) { continue; }
+
+ if (isset($this->filters[$n])) {
+ $this->filters[$n][] = $type;
+ } else {
+ $this->filters[$n] = array($type);
+ }
}
}

0 comments on commit 56b40a8

Please sign in to comment.