@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | |
16 | 16 | protected static $_modders = []; |
17 | 17 | |
18 | - public static function add($name,callable $modder = null){ |
|
19 | - if( is_array($name) ) { |
|
18 | + public static function add($name, callable $modder = null) { |
|
19 | + if (is_array($name)) { |
|
20 | 20 | foreach ($name as $key => $value) { |
21 | 21 | static::$_modders[$key][] = $value; |
22 | 22 | } |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | - public static function single($name,callable $modder){ |
|
28 | + public static function single($name, callable $modder) { |
|
29 | 29 | static::$_modders[$name] = [$modder]; |
30 | 30 | } |
31 | 31 | |
32 | - public static function remove($name,callable $modder = null){ |
|
33 | - if($modder === null) { |
|
32 | + public static function remove($name, callable $modder = null) { |
|
33 | + if ($modder === null) { |
|
34 | 34 | unset(static::$_modders[$name]); |
35 | 35 | } else { |
36 | - if ($idx = array_search($modder,static::$_modders[$name],true)) |
|
36 | + if ($idx = array_search($modder, static::$_modders[$name], true)) |
|
37 | 37 | unset(static::$_modders[$name][$idx]); |
38 | 38 | } |
39 | 39 | } |
40 | 40 | |
41 | - public static function with($names, $default){ |
|
42 | - foreach ((array)$names as $name) { |
|
41 | + public static function with($names, $default) { |
|
42 | + foreach ((array) $names as $name) { |
|
43 | 43 | if (!empty(static::$_modders[$name])) { |
44 | 44 | $value = $default; |
45 | - $args = array_slice( func_get_args(), 2 ); |
|
45 | + $args = array_slice(func_get_args(), 2); |
|
46 | 46 | foreach (static::$_modders[$name] as $modder) { |
47 | - $value = call_user_func( $modder,$value,$args ); |
|
47 | + $value = call_user_func($modder, $value, $args); |
|
48 | 48 | } |
49 | 49 | return $value; |
50 | 50 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | protected static $_modders = []; |
17 | 17 | |
18 | - public static function add($name,callable $modder = null){ |
|
18 | + public static function add($name,callable $modder = null) { |
|
19 | 19 | if( is_array($name) ) { |
20 | 20 | foreach ($name as $key => $value) { |
21 | 21 | static::$_modders[$key][] = $value; |
@@ -25,20 +25,21 @@ discard block |
||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | - public static function single($name,callable $modder){ |
|
28 | + public static function single($name,callable $modder) { |
|
29 | 29 | static::$_modders[$name] = [$modder]; |
30 | 30 | } |
31 | 31 | |
32 | - public static function remove($name,callable $modder = null){ |
|
32 | + public static function remove($name,callable $modder = null) { |
|
33 | 33 | if($modder === null) { |
34 | 34 | unset(static::$_modders[$name]); |
35 | 35 | } else { |
36 | - if ($idx = array_search($modder,static::$_modders[$name],true)) |
|
37 | - unset(static::$_modders[$name][$idx]); |
|
36 | + if ($idx = array_search($modder,static::$_modders[$name],true)) { |
|
37 | + unset(static::$_modders[$name][$idx]); |
|
38 | + } |
|
38 | 39 | } |
39 | 40 | } |
40 | 41 | |
41 | - public static function with($names, $default){ |
|
42 | + public static function with($names, $default) { |
|
42 | 43 | foreach ((array)$names as $name) { |
43 | 44 | if (!empty(static::$_modders[$name])) { |
44 | 45 | $value = $default; |