@@ -140,9 +140,9 @@ |
||
| 140 | 140 | { |
| 141 | 141 | $stat = new driverStatistic(); |
| 142 | 142 | $stat->setInfo('[Devnull] A void info string') |
| 143 | - ->setSize(0) |
|
| 144 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | - ->setRawData(null); |
|
| 143 | + ->setSize(0) |
|
| 144 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
| 145 | + ->setRawData(null); |
|
| 146 | 146 | |
| 147 | 147 | return $stat; |
| 148 | 148 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | public function dispatch($eventName, ...$args) |
| 67 | 67 | { |
| 68 | 68 | $eventName = 'on' . ucfirst($eventName); |
| 69 | - if(array_key_exists($eventName, $this->events)){ |
|
| 70 | - foreach ($this->events[ $eventName ] as $event) { |
|
| 69 | + if (array_key_exists($eventName, $this->events)) { |
|
| 70 | + foreach ($this->events[$eventName] as $event) { |
|
| 71 | 71 | call_user_func_array($event, $args); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function __call($name, $arguments) |
| 83 | 83 | { |
| 84 | - if(strpos($name, 'on') === 0){ |
|
| 85 | - if(is_callable($arguments[0])){ |
|
| 86 | - if(isset($arguments[1]) && is_string($arguments[0])){ |
|
| 84 | + if (strpos($name, 'on') === 0) { |
|
| 85 | + if (is_callable($arguments[0])) { |
|
| 86 | + if (isset($arguments[1]) && is_string($arguments[0])) { |
|
| 87 | 87 | $this->events[$name][$arguments[1]] = $arguments[0]; |
| 88 | - }else { |
|
| 88 | + } else { |
|
| 89 | 89 | $this->events[$name][] = $arguments[0]; |
| 90 | 90 | } |
| 91 | - }else{ |
|
| 91 | + } else { |
|
| 92 | 92 | throw new \InvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
| 93 | 93 | } |
| 94 | - }else{ |
|
| 94 | + } else { |
|
| 95 | 95 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function unbindEventCallback($eventName, $callbackName) |
| 105 | 105 | { |
| 106 | - if(isset($this->events[$eventName][$callbackName])){ |
|
| 106 | + if (isset($this->events[$eventName][$callbackName])) { |
|
| 107 | 107 | unset($this->events[$eventName][$callbackName]); |
| 108 | 108 | return true; |
| 109 | 109 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | if (!class_exists('phpFastCache\CacheManager')) { |
| 16 | 16 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
| 17 | 17 | $status = 255; |
| 18 | -}else{ |
|
| 18 | +} else { |
|
| 19 | 19 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | if (!class_exists('phpFastCache\CacheManager')) { |
| 16 | 16 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
| 17 | 17 | $status = 255; |
| 18 | -}else{ |
|
| 18 | +} else{ |
|
| 19 | 19 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -25,21 +25,21 @@ |
||
| 25 | 25 | $actOnAll = new ActOnAll(); |
| 26 | 26 | $statsAry = $actOnAll->getStats(); |
| 27 | 27 | |
| 28 | -if(is_array($statsAry)){ |
|
| 29 | - if(count($statsAry) !== 3){ |
|
| 28 | +if (is_array($statsAry)) { |
|
| 29 | + if (count($statsAry) !== 3) { |
|
| 30 | 30 | $status = 1; |
| 31 | 31 | echo 'Wrong count of driverStatistics objects: Got ' . count($statsAry) . " element(s), expected 3\n"; |
| 32 | 32 | goto endOfTest; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | foreach ($statsAry as $stat) { |
| 36 | - if(!is_object($stat) || !($stat instanceof driverStatistic)){ |
|
| 36 | + if (!is_object($stat) || !($stat instanceof driverStatistic)) { |
|
| 37 | 37 | echo "\$statsAry contains one element that is not an driverStatistic object\n"; |
| 38 | 38 | goto endOfTest; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | echo "[PASS] ActOnAll helper passed all tests\n"; |
| 42 | -}else{ |
|
| 42 | +} else { |
|
| 43 | 43 | $status = 1; |
| 44 | 44 | echo "\$statsAry is not an array\n"; |
| 45 | 45 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | if (!class_exists('phpFastCache\CacheManager')) { |
| 16 | 16 | echo "[FAIL] Autoload failed to find the CacheManager\n"; |
| 17 | 17 | $status = 255; |
| 18 | -}else{ |
|
| 18 | +} else{ |
|
| 19 | 19 | echo "[PASS] Autoload successfully found the CacheManager\n"; |
| 20 | 20 | } |
| 21 | 21 | |