@@ -243,7 +243,7 @@ |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | //variadic functions will only have one argument. To account for those, append any remaining arguments to the list |
| 246 | - return array_merge($parameters, $args); |
|
| 246 | + return array_merge($parameters, $args); |
|
| 247 | 247 | }; |
| 248 | 248 | } |
| 249 | 249 | |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class Dice |
| 17 | 17 | { |
| 18 | - private $rules = []; // Rules which have been set using addRule() |
|
| 19 | - private $cache = []; // A cache of closures based on class name so each class is only reflected once |
|
| 20 | - private $instances = []; // Stores any instances marked as 'shared' so create() can return the same instance |
|
| 18 | + private $rules = []; // Rules which have been set using addRule() |
|
| 19 | + private $cache = []; // A cache of closures based on class name so each class is only reflected once |
|
| 20 | + private $instances = []; // Stores any instances marked as 'shared' so create() can return the same instance |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Constructor which allows setting a default ruleset to apply to all objects. |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | //If there are shared instances, create them and merge them with shared instances higher up the object graph |
| 99 | 99 | if (isset($rule['shareInstances'])) { |
| 100 | - $closure = function(array $args, array $share) use ($closure, $rule) { |
|
| 100 | + $closure = function (array $args, array $share) use ($closure, $rule) { |
|
| 101 | 101 | return $closure($args, array_merge($args, $share, array_map([$this, 'create'], $rule['shareInstances']))); |
| 102 | 102 | }; |
| 103 | 103 | } |
@@ -212,7 +212,8 @@ |
||
| 212 | 212 | list($class, $param, $sub) = $pi; |
| 213 | 213 | |
| 214 | 214 | // First, loop through $args and see if each value can match the current parameter based on type hint |
| 215 | - if (!empty($args)) { // This if statement actually gives a ~10% speed increase when $args isn't set |
|
| 215 | + if (!empty($args)) { |
|
| 216 | +// This if statement actually gives a ~10% speed increase when $args isn't set |
|
| 216 | 217 | foreach ($args as $i => $arg) { |
| 217 | 218 | if ($class !== null |
| 218 | 219 | && ($arg instanceof $class || ($arg === null && $param->allowsNull())) |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | $map = json_decode($json, true); |
| 27 | 27 | if (!is_array($map)) { |
| 28 | - throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
| 28 | + throw new \Exception('Could not decode json: '.json_last_error_msg()); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | if (isset($map['rules'])) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (count(array_filter(array_keys($rule[$key]), 'is_string')) === 0) { |
| 39 | - throw new \InvalidArgumentException('Rule option ' . $key . ' must be a an associative array'); |
|
| 39 | + throw new \InvalidArgumentException('Rule option '.$key.' must be a an associative array'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if (!is_bool($rule[$key])) { |
| 51 | - throw new \InvalidArgumentException('Rule option ' . $key . ' must be true or false'); |
|
| 51 | + throw new \InvalidArgumentException('Rule option '.$key.' must be true or false'); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (count(array_filter(array_keys($rule[$key]), 'is_string')) > 0) { |
| 62 | - throw new \InvalidArgumentException('Rule option ' . $key |
|
| 62 | + throw new \InvalidArgumentException('Rule option '.$key |
|
| 63 | 63 | . ' must be a sequential array, not an associative array'); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | foreach ($rule as $name => $value) { |
| 72 | 72 | if (!in_array($name, $validKeys)) { |
| 73 | - throw new \InvalidArgumentException('Invalid rule option: ' . $name); |
|
| 73 | + throw new \InvalidArgumentException('Invalid rule option: '.$name); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |