Completed
Push — master ( bb34f0...023ff5 )
by Stefano
03:08
created
classes/Filter.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@
 block discarded – undo
15 15
 
16 16
     protected static $_modders = [];
17 17
 
18
-    public static function add($names, callable $modder = null){
19
-      if( null === $modder ) foreach ( (array)$names as $name => $callback ) {
18
+    public static function add($names, callable $modder = null) {
19
+      if (null === $modder) foreach ((array) $names as $name => $callback) {
20 20
         static::$_modders[$name][] = $callback;
21
-      } else foreach ( (array)$names as $name ) {
21
+      } else foreach ((array) $names as $name) {
22 22
         static::$_modders[$name][] = $modder;
23 23
       }
24 24
     }
25 25
 
26
-    public static function single($name,callable $modder){
26
+    public static function single($name, callable $modder) {
27 27
       static::$_modders[$name] = [$modder];
28 28
     }
29 29
 
30
-    public static function remove($name,callable $modder = null){
31
-      if($modder === null) {
30
+    public static function remove($name, callable $modder = null) {
31
+      if ($modder === null) {
32 32
         unset(static::$_modders[$name]);
33 33
       } else {
34
-        if ($idx = array_search($modder,static::$_modders[$name],true))
34
+        if ($idx = array_search($modder, static::$_modders[$name], true))
35 35
           unset(static::$_modders[$name][$idx]);
36 36
       }
37 37
     }
38 38
 
39
-    public static function with($names, $default){
40
-      foreach ((array)$names as $name) {
39
+    public static function with($names, $default) {
40
+      foreach ((array) $names as $name) {
41 41
         if (!empty(static::$_modders[$name])) {
42 42
           $value = $default;
43
-          $args  = array_slice( func_get_args(), 2 );
43
+          $args  = array_slice(func_get_args(), 2);
44 44
           foreach (static::$_modders[$name] as $modder) {
45
-            $value = call_user_func( $modder,$value,$args );
45
+            $value = call_user_func($modder, $value, $args);
46 46
           }
47 47
           return $value;
48 48
         }
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,28 +15,33 @@
 block discarded – undo
15 15
 
16 16
     protected static $_modders = [];
17 17
 
18
-    public static function add($names, callable $modder = null){
19
-      if( null === $modder ) foreach ( (array)$names as $name => $callback ) {
18
+    public static function add($names, callable $modder = null) {
19
+      if( null === $modder ) {
20
+        foreach ( (array)$names as $name => $callback ) {
20 21
         static::$_modders[$name][] = $callback;
21
-      } else foreach ( (array)$names as $name ) {
22
+      }
23
+      } else {
24
+        foreach ( (array)$names as $name ) {
22 25
         static::$_modders[$name][] = $modder;
23 26
       }
27
+      }
24 28
     }
25 29
 
26
-    public static function single($name,callable $modder){
30
+    public static function single($name,callable $modder) {
27 31
       static::$_modders[$name] = [$modder];
28 32
     }
29 33
 
30
-    public static function remove($name,callable $modder = null){
34
+    public static function remove($name,callable $modder = null) {
31 35
       if($modder === null) {
32 36
         unset(static::$_modders[$name]);
33 37
       } else {
34
-        if ($idx = array_search($modder,static::$_modders[$name],true))
35
-          unset(static::$_modders[$name][$idx]);
38
+        if ($idx = array_search($modder,static::$_modders[$name],true)) {
39
+                  unset(static::$_modders[$name][$idx]);
40
+        }
36 41
       }
37 42
     }
38 43
 
39
-    public static function with($names, $default){
44
+    public static function with($names, $default) {
40 45
       foreach ((array)$names as $name) {
41 46
         if (!empty(static::$_modders[$name])) {
42 47
           $value = $default;
Please login to merge, or discard this patch.