@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @param \Psr\Cache\CacheItemInterface $item |
63 | - * @return mixed |
|
63 | + * @return boolean |
|
64 | 64 | * @throws phpFastCacheInvalidArgumentException |
65 | 65 | */ |
66 | 66 | protected function driverWrite(CacheItemInterface $item) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * @param string $optionName |
148 | 148 | * @param mixed $optionValue |
149 | - * @return bool |
|
149 | + * @return boolean|null |
|
150 | 150 | * @throws phpFastCacheInvalidArgumentException |
151 | 151 | */ |
152 | 152 | public static function isValidOption($optionName, $optionValue) |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | - * @return array |
|
182 | + * @return string[] |
|
183 | 183 | */ |
184 | 184 | public static function getValidOptions() |
185 | 185 | { |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * @return array |
|
190 | + * @return string[] |
|
191 | 191 | */ |
192 | 192 | public static function getRequiredOptions() |
193 | 193 | { |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | public function dispatch($eventName, ...$args) |
70 | 70 | { |
71 | 71 | $eventName = 'on' . ucfirst($eventName); |
72 | - if(array_key_exists($eventName, $this->events)){ |
|
73 | - foreach ($this->events[ $eventName ] as $event) { |
|
72 | + if (array_key_exists($eventName, $this->events)) { |
|
73 | + foreach ($this->events[$eventName] as $event) { |
|
74 | 74 | call_user_func_array($event, $args); |
75 | 75 | } |
76 | 76 | } |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function __call($name, $arguments) |
86 | 86 | { |
87 | - if(strpos($name, 'on') === 0){ |
|
88 | - if(is_callable($arguments[0])){ |
|
89 | - if(isset($arguments[1]) && is_string($arguments[0])){ |
|
87 | + if (strpos($name, 'on') === 0) { |
|
88 | + if (is_callable($arguments[0])) { |
|
89 | + if (isset($arguments[1]) && is_string($arguments[0])) { |
|
90 | 90 | $this->events[$name][$arguments[1]] = $arguments[0]; |
91 | - }else { |
|
91 | + } else { |
|
92 | 92 | $this->events[$name][] = $arguments[0]; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else { |
|
95 | 95 | throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
96 | 96 | } |
97 | - }else{ |
|
97 | + } else { |
|
98 | 98 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
99 | 99 | } |
100 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function unbindEventCallback($eventName, $callbackName) |
108 | 108 | { |
109 | - if(isset($this->events[$eventName][$callbackName])){ |
|
109 | + if (isset($this->events[$eventName][$callbackName])) { |
|
110 | 110 | unset($this->events[$eventName][$callbackName]); |
111 | 111 | return true; |
112 | 112 | } |
@@ -88,13 +88,13 @@ |
||
88 | 88 | if(is_callable($arguments[0])){ |
89 | 89 | if(isset($arguments[1]) && is_string($arguments[0])){ |
90 | 90 | $this->events[$name][$arguments[1]] = $arguments[0]; |
91 | - }else { |
|
91 | + } else { |
|
92 | 92 | $this->events[$name][] = $arguments[0]; |
93 | 93 | } |
94 | - }else{ |
|
94 | + } else{ |
|
95 | 95 | throw new phpFastCacheInvalidArgumentException(sprintf('Expected Callable, got "%s"', gettype($arguments[0]))); |
96 | 96 | } |
97 | - }else{ |
|
97 | + } else{ |
|
98 | 98 | throw new \BadMethodCallException('An event must start with "on" such as "onCacheGetItem"'); |
99 | 99 | } |
100 | 100 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->driver->setItem($this); |
44 | 44 | } else { |
45 | 45 | throw new phpFastCacheInvalidArgumentException(sprintf('$key must be a string, got type "%s" instead.', |
46 | - gettype($key))); |
|
46 | + gettype($key))); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
65 | - * @return mixed |
|
65 | + * @return boolean |
|
66 | 66 | * @throws phpFastCacheInvalidArgumentException |
67 | 67 | */ |
68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | protected function driverRead(CacheItemInterface $item) |
81 | 81 | { |
82 | 82 | return [ |
83 | - self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
84 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
83 | + self::DRIVER_DATA_WRAPPER_INDEX => false, |
|
84 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
86 | 86 | ]; |
87 | 87 | } |
88 | 88 | /** |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | { |
132 | 132 | $stat = new driverStatistic(); |
133 | 133 | $stat->setInfo('[Devfalse] A void info string') |
134 | - ->setSize(0) |
|
135 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | - ->setRawData(false); |
|
134 | + ->setSize(0) |
|
135 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
136 | + ->setRawData(false); |
|
137 | 137 | |
138 | 138 | return $stat; |
139 | 139 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @param \Psr\Cache\CacheItemInterface $item |
65 | - * @return mixed |
|
65 | + * @return boolean |
|
66 | 66 | * @throws phpFastCacheInvalidArgumentException |
67 | 67 | */ |
68 | 68 | protected function driverWrite(CacheItemInterface $item) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | protected function driverRead(CacheItemInterface $item) |
81 | 81 | { |
82 | 82 | return [ |
83 | - self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | - self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | - self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
83 | + self::DRIVER_DATA_WRAPPER_INDEX => true, |
|
84 | + self::DRIVER_TAGS_WRAPPER_INDEX => [], |
|
85 | + self::DRIVER_EDATE_WRAPPER_INDEX => new \DateTime(), |
|
86 | 86 | ]; |
87 | 87 | } |
88 | 88 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | { |
133 | 133 | $stat = new driverStatistic(); |
134 | 134 | $stat->setInfo('[Devtrue] A void info string') |
135 | - ->setSize(0) |
|
136 | - ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | - ->setRawData(true); |
|
135 | + ->setSize(0) |
|
136 | + ->setData(implode(', ', array_keys($this->itemInstances))) |
|
137 | + ->setRawData(true); |
|
138 | 138 | |
139 | 139 | return $stat; |
140 | 140 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | { |
49 | 49 | $keyHashFunction = $this->driver->getConfigOption('defaultKeyHashFunction'); |
50 | 50 | |
51 | - if($keyHashFunction){ |
|
51 | + if ($keyHashFunction) { |
|
52 | 52 | return $keyHashFunction($this->getKey()); |
53 | - }else{ |
|
53 | + } else { |
|
54 | 54 | return md5($this->getKey()); |
55 | 55 | } |
56 | 56 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function getCreationDate() |
96 | 96 | { |
97 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
97 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
98 | 98 | return $this->creationDate; |
99 | - }else{ |
|
99 | + } else { |
|
100 | 100 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
101 | 101 | } |
102 | 102 | } |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function setCreationDate(\DateTimeInterface $date) |
110 | 110 | { |
111 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
111 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
112 | 112 | $this->creationDate = $date; |
113 | 113 | return $this; |
114 | - }else{ |
|
114 | + } else { |
|
115 | 115 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
116 | 116 | } |
117 | 117 | } |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getModificationDate() |
124 | 124 | { |
125 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
125 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
126 | 126 | return $this->modificationDate; |
127 | - }else{ |
|
127 | + } else { |
|
128 | 128 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
129 | 129 | } |
130 | 130 | } |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function setModificationDate(\DateTimeInterface $date) |
138 | 138 | { |
139 | - if($this->driver->getConfig()['itemDetailedDate']){ |
|
139 | + if ($this->driver->getConfig()['itemDetailedDate']) { |
|
140 | 140 | $this->modificationDate = $date; |
141 | 141 | return $this; |
142 | - }else{ |
|
142 | + } else { |
|
143 | 143 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
144 | 144 | } |
145 | 145 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | public function removeTag($tagName) |
307 | 307 | { |
308 | 308 | if (($key = array_search($tagName, $this->tags)) !== false) { |
309 | - unset($this->tags[ $key ]); |
|
309 | + unset($this->tags[$key]); |
|
310 | 310 | $this->removedTags[] = $tagName; |
311 | 311 | } |
312 | 312 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | final public function __debugInfo() |
383 | 383 | { |
384 | 384 | $info = get_object_vars($this); |
385 | - $info[ 'driver' ] = 'object(' . get_class($info[ 'driver' ]) . ')'; |
|
385 | + $info['driver'] = 'object(' . get_class($info['driver']) . ')'; |
|
386 | 386 | |
387 | 387 | return (array) $info; |
388 | 388 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | if($keyHashFunction){ |
52 | 52 | return $keyHashFunction($this->getKey()); |
53 | - }else{ |
|
53 | + } else{ |
|
54 | 54 | return md5($this->getKey()); |
55 | 55 | } |
56 | 56 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | if($this->driver->getConfig()['itemDetailedDate']){ |
98 | 98 | return $this->creationDate; |
99 | - }else{ |
|
99 | + } else{ |
|
100 | 100 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
101 | 101 | } |
102 | 102 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if($this->driver->getConfig()['itemDetailedDate']){ |
112 | 112 | $this->creationDate = $date; |
113 | 113 | return $this; |
114 | - }else{ |
|
114 | + } else{ |
|
115 | 115 | throw new \LogicException('Cannot access to the creation date when the "itemDetailedDate" configuration is disabled.'); |
116 | 116 | } |
117 | 117 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | if($this->driver->getConfig()['itemDetailedDate']){ |
126 | 126 | return $this->modificationDate; |
127 | - }else{ |
|
127 | + } else{ |
|
128 | 128 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
129 | 129 | } |
130 | 130 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if($this->driver->getConfig()['itemDetailedDate']){ |
140 | 140 | $this->modificationDate = $date; |
141 | 141 | return $this; |
142 | - }else{ |
|
142 | + } else{ |
|
143 | 143 | throw new \LogicException('Cannot access to the modification date when the "itemDetailedDate" configuration is disabled.'); |
144 | 144 | } |
145 | 145 | } |