@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * CacheDriverAbstract constructor. |
| 34 | 34 | */ |
| 35 | - public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null){ |
|
| 35 | + public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null) { |
|
| 36 | 36 | $this->options = $options ?? new CacheOptions; |
| 37 | 37 | $this->logger = $logger ?? new NullLogger; |
| 38 | 38 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function getMultiple($keys, $default = null):array{ |
| 47 | 47 | $data = []; |
| 48 | 48 | |
| 49 | - foreach($this->getData($keys) as $key){ |
|
| 49 | + foreach ($this->getData($keys) as $key) { |
|
| 50 | 50 | $data[$key] = $this->get($key, $default); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function setMultiple($values, $ttl = null):bool{ |
| 58 | 58 | $return = []; |
| 59 | 59 | |
| 60 | - foreach($this->getData($values) as $key => $value){ |
|
| 60 | + foreach ($this->getData($values) as $key => $value) { |
|
| 61 | 61 | $return[] = $this->set($key, $value, $ttl); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function deleteMultiple($keys):bool{ |
| 69 | 69 | $return = []; |
| 70 | 70 | |
| 71 | - foreach($this->getData($keys) as $key){ |
|
| 71 | + foreach ($this->getData($keys) as $key) { |
|
| 72 | 72 | $return[] = $this->delete($key); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | protected function checkKey($key):string{ |
| 85 | 85 | |
| 86 | - if(!is_string($key) || empty($key)){ |
|
| 86 | + if (!is_string($key) || empty($key)) { |
|
| 87 | 87 | throw new InvalidArgumentException('invalid cache key: "'.$key.'"'); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | protected function checkKeyArray(array $keys):void{ |
| 99 | 99 | |
| 100 | - foreach($keys as $key){ |
|
| 100 | + foreach ($keys as $key) { |
|
| 101 | 101 | $this->checkKey($key); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -111,10 +111,10 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function getData($data):array{ |
| 113 | 113 | |
| 114 | - if(is_array($data)){ |
|
| 114 | + if (is_array($data)) { |
|
| 115 | 115 | return $data; |
| 116 | 116 | } |
| 117 | - elseif($data instanceof Traversable){ |
|
| 117 | + elseif ($data instanceof Traversable) { |
|
| 118 | 118 | return iterator_to_array($data); // @codeCoverageIgnore |
| 119 | 119 | } |
| 120 | 120 | |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | * @return int|null |
| 128 | 128 | * @throws \Psr\SimpleCache\InvalidArgumentException |
| 129 | 129 | */ |
| 130 | - protected function getTTL($ttl):?int{ |
|
| 130 | + protected function getTTL($ttl): ?int{ |
|
| 131 | 131 | |
| 132 | - if($ttl instanceof DateInterval){ |
|
| 132 | + if ($ttl instanceof DateInterval) { |
|
| 133 | 133 | return (new DateTime)->add($ttl)->getTimeStamp() - time(); |
| 134 | 134 | } |
| 135 | - else if((is_int($ttl) && $ttl > 0) || $ttl === null){ |
|
| 135 | + else if ((is_int($ttl) && $ttl > 0) || $ttl === null) { |
|
| 136 | 136 | return $ttl; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function checkReturn(array $booleans):bool{ |
| 148 | 148 | |
| 149 | - foreach($booleans as $boolean){ |
|
| 149 | + foreach ($booleans as $boolean) { |
|
| 150 | 150 | |
| 151 | - if(!(bool)$boolean){ |
|
| 151 | + if (!(bool)$boolean) { |
|
| 152 | 152 | return false; // @codeCoverageIgnore |
| 153 | 153 | } |
| 154 | 154 | |