@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param \chillerlan\Settings\SettingsContainerInterface|null $options |
32 | 32 | * @param \Psr\Log\LoggerInterface|null $logger |
33 | 33 | */ |
34 | - public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null){ |
|
34 | + public function __construct(SettingsContainerInterface $options = null, LoggerInterface $logger = null) { |
|
35 | 35 | $this->options = $options ?? new CacheOptions; |
36 | 36 | $this->logger = $logger ?? new NullLogger; |
37 | 37 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getMultiple($keys, $default = null):array{ |
46 | 46 | $data = []; |
47 | 47 | |
48 | - foreach($this->getData($keys) as $key){ |
|
48 | + foreach ($this->getData($keys) as $key) { |
|
49 | 49 | $data[$key] = $this->get($key, $default); |
50 | 50 | } |
51 | 51 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function setMultiple($values, $ttl = null):bool{ |
57 | 57 | $return = []; |
58 | 58 | |
59 | - foreach($this->getData($values) as $key => $value){ |
|
59 | + foreach ($this->getData($values) as $key => $value) { |
|
60 | 60 | $return[] = $this->set($key, $value, $ttl); |
61 | 61 | } |
62 | 62 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function deleteMultiple($keys):bool{ |
68 | 68 | $return = []; |
69 | 69 | |
70 | - foreach($this->getData($keys) as $key){ |
|
70 | + foreach ($this->getData($keys) as $key) { |
|
71 | 71 | $return[] = $this->delete($key); |
72 | 72 | } |
73 | 73 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | protected function checkKey($key):string{ |
84 | 84 | |
85 | - if(!is_string($key) || empty($key)){ |
|
85 | + if (!is_string($key) || empty($key)) { |
|
86 | 86 | $msg = 'invalid cache key: "'.$key.'"'; |
87 | 87 | $this->logger->error($msg); |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | protected function checkKeyArray(array $keys):void{ |
101 | 101 | |
102 | - foreach($keys as $key){ |
|
102 | + foreach ($keys as $key) { |
|
103 | 103 | $this->checkKey($key); |
104 | 104 | } |
105 | 105 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function getData($data):array{ |
115 | 115 | |
116 | - if(is_array($data)){ |
|
116 | + if (is_array($data)) { |
|
117 | 117 | return $data; |
118 | 118 | } |
119 | - elseif($data instanceof Traversable){ |
|
119 | + elseif ($data instanceof Traversable) { |
|
120 | 120 | return iterator_to_array($data); // @codeCoverageIgnore |
121 | 121 | } |
122 | 122 | |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | * @return int|null |
133 | 133 | * @throws \Psr\SimpleCache\InvalidArgumentException |
134 | 134 | */ |
135 | - protected function getTTL($ttl):?int{ |
|
135 | + protected function getTTL($ttl): ?int{ |
|
136 | 136 | |
137 | - if($ttl instanceof DateInterval){ |
|
137 | + if ($ttl instanceof DateInterval) { |
|
138 | 138 | return (new DateTime)->add($ttl)->getTimeStamp() - time(); |
139 | 139 | } |
140 | - else if((is_int($ttl) && $ttl > 0) || $ttl === null){ |
|
140 | + else if ((is_int($ttl) && $ttl > 0) || $ttl === null) { |
|
141 | 141 | return $ttl; |
142 | 142 | } |
143 | 143 | |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function checkReturn(array $booleans):bool{ |
156 | 156 | |
157 | - foreach($booleans as $bool){ |
|
157 | + foreach ($booleans as $bool) { |
|
158 | 158 | |
159 | - if(!(bool)$bool){ |
|
159 | + if (!(bool)$bool) { |
|
160 | 160 | return false; // @codeCoverageIgnore |
161 | 161 | } |
162 | 162 |