Passed
Pull Request — main (#63)
by Sílvio
06:20 queued 03:25
created
src/Helpers/CacheRedisHelper.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
 class CacheRedisHelper
14 14
 {
15 15
 
16
-  /**
17
-  * serializes or unserializes data based on the $serialize flag.
18
-  * 
19
-  * @param mixed $data
20
-  * @param bool  $serialize
21
-  * @return mixed
22
-  */
23
-  public static function serialize(mixed $data, bool $serialize = true): mixed
24
-  {
16
+    /**
17
+     * serializes or unserializes data based on the $serialize flag.
18
+     * 
19
+     * @param mixed $data
20
+     * @param bool  $serialize
21
+     * @return mixed
22
+     */
23
+    public static function serialize(mixed $data, bool $serialize = true): mixed
24
+    {
25 25
     if($serialize) {
26
-      return serialize($data);
26
+        return serialize($data);
27 27
     }
28 28
 
29 29
     return unserialize($data);
30 30
 
31
-  }
31
+    }
32 32
 
33 33
     /**
34
-    * Validates a cache item.
35
-    *  
36
-    * @param array $item
37
-    * @return void
38
-    */
34
+     * Validates a cache item.
35
+     *  
36
+     * @param array $item
37
+     * @return void
38
+     */
39 39
     public static function validateCacheItem(array $item): void
40 40
     {
41 41
         CacheerHelper::validateCacheItem(
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
         return CacheerHelper::mergeCacheData($cacheData);
56 56
     }
57 57
 
58
-  /**
59
-  * Generates an array identifier for cache data.
60
-  * 
61
-  * @param mixed $currentCacheData
62
-  * @param mixed $cacheData
63
-  * @return array
64
-  */
65
-  public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array
66
-  {
67
-      return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
68
-  }
58
+    /**
59
+     * Generates an array identifier for cache data.
60
+     * 
61
+     * @param mixed $currentCacheData
62
+     * @param mixed $cacheData
63
+     * @return array
64
+     */
65
+    public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData): array
66
+    {
67
+        return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
68
+    }
69 69
 
70 70
 }
71 71
 
Please login to merge, or discard this patch.
src/Service/CacheMutator.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  discard block
 block discarded – undo
13 13
 class CacheMutator
14 14
 {
15 15
     /**
16
-    * @var Cacheer
17
-    */
16
+     * @var Cacheer
17
+     */
18 18
     private Cacheer $cacheer;
19 19
 
20 20
     /**
21
-    * CacheMutator constructor.
22
-    *
23
-    * @param Cacheer $cacheer
24
-    */
21
+     * CacheMutator constructor.
22
+     *
23
+     * @param Cacheer $cacheer
24
+     */
25 25
     public function __construct(Cacheer $cacheer)
26 26
     {
27 27
         $this->cacheer = $cacheer;
28 28
     }
29 29
 
30 30
     /**
31
-    * Adds a cache item if it does not already exist.
32
-    *
33
-    * @param string $cacheKey
34
-    * @param mixed $cacheData
35
-    * @param string $namespace
36
-    * @param int|string $ttl
37
-    * @return bool
38
-    */
31
+     * Adds a cache item if it does not already exist.
32
+     *
33
+     * @param string $cacheKey
34
+     * @param mixed $cacheData
35
+     * @param string $namespace
36
+     * @param int|string $ttl
37
+     * @return bool
38
+     */
39 39
     public function add(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600): bool
40 40
     {
41 41
         if (!empty($this->cacheer->getCache($cacheKey, $namespace))) {
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     /**
52
-    * Appends data to an existing cache item.
53
-    *
54
-    * @param string $cacheKey
55
-    * @param mixed $cacheData
56
-    * @param string $namespace
57
-    * @return bool
58
-    */
52
+     * Appends data to an existing cache item.
53
+     *
54
+     * @param string $cacheKey
55
+     * @param mixed $cacheData
56
+     * @param string $namespace
57
+     * @return bool
58
+     */
59 59
     public function appendCache(string $cacheKey, mixed $cacheData, string $namespace = ''): bool
60 60
     {
61 61
         $this->cacheer->cacheStore->appendCache($cacheKey, $cacheData, $namespace);
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
     }
66 66
 
67 67
     /**
68
-    * Clears a specific cache item.
69
-    *
70
-    * @param string $cacheKey
71
-    * @param string $namespace
72
-    * @return bool
73
-    */
68
+     * Clears a specific cache item.
69
+     *
70
+     * @param string $cacheKey
71
+     * @param string $namespace
72
+     * @return bool
73
+     */
74 74
     public function clearCache(string $cacheKey, string $namespace = ''): bool
75 75
     {
76 76
         $this->cacheer->cacheStore->clearCache($cacheKey, $namespace);
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
     }
81 81
 
82 82
     /**
83
-    * Decrements a numeric cache item by a specified amount.
84
-    *
85
-    * @param string $cacheKey
86
-    * @param int $amount
87
-    * @param string $namespace
88
-    * @return bool
89
-    */
83
+     * Decrements a numeric cache item by a specified amount.
84
+     *
85
+     * @param string $cacheKey
86
+     * @param int $amount
87
+     * @param string $namespace
88
+     * @return bool
89
+     */
90 90
     public function decrement(string $cacheKey, int $amount = 1, string $namespace = ''): bool
91 91
     {
92 92
         return $this->increment($cacheKey, ($amount * -1), $namespace);
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
     }
109 109
 
110 110
     /**
111
-    * Flushes the entire cache.
112
-    *
113
-    * @return bool
114
-    */
111
+     * Flushes the entire cache.
112
+     *
113
+     * @return bool
114
+     */
115 115
     public function flushCache(): bool
116 116
     {
117 117
         $this->cacheer->cacheStore->flushCache();
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
     }
161 161
 
162 162
     /**
163
-    * Puts multiple cache items in a batch.
164
-    *
165
-    * @param array $items
166
-    * @param string $namespace
167
-    * @param int $batchSize
168
-    * @return bool
169
-    */
163
+     * Puts multiple cache items in a batch.
164
+     *
165
+     * @param array $items
166
+     * @param string $namespace
167
+     * @param int $batchSize
168
+     * @return bool
169
+     */
170 170
     public function putMany(array $items, string $namespace = '', int $batchSize = 100): bool
171 171
     {
172 172
         $this->cacheer->cacheStore->putMany($items, $namespace, $batchSize);
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     /**
179
-    * Renews the cache item with a new TTL.
180
-    *
181
-    * @param string $cacheKey
182
-    * @param int|string $ttl
183
-    * @param string $namespace
184
-    * @return bool
185
-    */
179
+     * Renews the cache item with a new TTL.
180
+     *
181
+     * @param string $cacheKey
182
+     * @param int|string $ttl
183
+     * @param string $namespace
184
+     * @return bool
185
+     */
186 186
     public function renewCache(string $cacheKey, int|string $ttl = 3600, string $namespace = ''): bool
187 187
     {
188 188
         $this->cacheer->cacheStore->renewCache($cacheKey, $ttl, $namespace);
Please login to merge, or discard this patch.
tests/Unit/StaticAccessTest.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@
 block discarded – undo
35 35
             'driver' => 'file',
36 36
             'path' => '/tmp/cache',
37 37
         ];
38
-       Cacheer::setUp($options);
39
-       self::assertSame($options, Cacheer::getOptions());
38
+        Cacheer::setUp($options);
39
+        self::assertSame($options, Cacheer::getOptions());
40 40
     }
41 41
 
42 42
     public function testSetUpStaticWithOptionBuilder(): void
Please login to merge, or discard this patch.
src/Cacheer.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -63,66 +63,66 @@  discard block
 block discarded – undo
63 63
 final class Cacheer
64 64
 {
65 65
     /**
66
-    * @var string
67
-    */
66
+     * @var string
67
+     */
68 68
     private string $message;
69 69
 
70 70
     /**
71
-    * @var boolean
72
-    */
71
+     * @var boolean
72
+     */
73 73
     private bool $success;
74 74
 
75 75
     /**
76
-    * @var boolean
77
-    */
76
+     * @var boolean
77
+     */
78 78
     private bool $formatted = false;
79 79
 
80 80
     /**
81
-    * @var bool
82
-    */
81
+     * @var bool
82
+     */
83 83
     private bool $compression = false;
84 84
 
85 85
     /**
86
-    * @var string|null
87
-    */
86
+     * @var string|null
87
+     */
88 88
     private ?string $encryptionKey = null;
89 89
 
90 90
     /**
91
-    * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore
92
-    */
91
+     * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore
92
+     */
93 93
     public RedisCacheStore|DatabaseCacheStore|ArrayCacheStore|FileCacheStore $cacheStore;
94 94
 
95 95
     /**
96
-    * @var array
97
-    */
96
+     * @var array
97
+     */
98 98
     public array $options = [];
99 99
 
100 100
     /**
101
-    * @var CacheRetriever
102
-    */
101
+     * @var CacheRetriever
102
+     */
103 103
     private CacheRetriever $retriever;
104 104
 
105 105
     /**
106
-    * @var CacheMutator
107
-    */
106
+     * @var CacheMutator
107
+     */
108 108
     private CacheMutator $mutator;
109 109
 
110 110
     /**
111
-    * @var CacheConfig
112
-    */
111
+     * @var CacheConfig
112
+     */
113 113
     private CacheConfig $config;
114 114
 
115 115
     /**
116
-    * @var Cacheer|null
117
-    */
116
+     * @var Cacheer|null
117
+     */
118 118
     private static ?Cacheer $staticInstance = null;
119 119
 
120 120
 /**
121
-    * Cacheer constructor.
122
-    *
123
-    * @param array $options
124
-    * @param bool  $formatted
125
-    * @throws RuntimeException|Exceptions\CacheFileException
121
+ * Cacheer constructor.
122
+ *
123
+ * @param array $options
124
+ * @param bool  $formatted
125
+ * @throws RuntimeException|Exceptions\CacheFileException
126 126
  */
127 127
     public function __construct(array $options = [], bool $formatted = false)
128 128
     {
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
     }
183 183
 
184 184
     /**
185
-    * Enable encryption for cached data
186
-    *
187
-    * @param string $key
188
-    * @return $this
189
-    */
185
+     * Enable encryption for cached data
186
+     *
187
+     * @param string $key
188
+     * @return $this
189
+     */
190 190
     public function useEncryption(string $key): Cacheer
191 191
     {
192 192
         $this->encryptionKey = $key;
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
     }
195 195
 
196 196
     /**
197
-    * Enable or disable data compression
198
-    *
199
-    * @param bool $status
200
-    * @return $this
201
-    */
197
+     * Enable or disable data compression
198
+     *
199
+     * @param bool $status
200
+     * @return $this
201
+     */
202 202
     public function useCompression(bool $status = true): Cacheer
203 203
     {
204 204
         $this->compression = $status;
@@ -206,43 +206,43 @@  discard block
 block discarded – undo
206 206
     }
207 207
 
208 208
     /**
209
-    * Enables or disables the formatter for cache data.
210
-    * 
211
-    * @return void
212
-    */
209
+     * Enables or disables the formatter for cache data.
210
+     * 
211
+     * @return void
212
+     */
213 213
     public function useFormatter(): void
214 214
     {
215 215
         $this->formatted = !$this->formatted;
216 216
     }
217 217
 
218 218
     /**
219
-    * Validates the options provided for the Cacheer instance.
220
-    * 
221
-    * @param array $options
222
-    * @return void
223
-    */
219
+     * Validates the options provided for the Cacheer instance.
220
+     * 
221
+     * @param array $options
222
+     * @return void
223
+     */
224 224
     private function validateOptions(array $options): void
225 225
     {
226 226
         $this->options = $options;
227 227
     }
228 228
 
229 229
     /**
230
-    * Checks if the last operation was successful.
231
-    * 
232
-    * @return bool
233
-    */
230
+     * Checks if the last operation was successful.
231
+     * 
232
+     * @return bool
233
+     */
234 234
     public function isSuccess(): bool
235 235
     {
236 236
         return $this->success;
237 237
     }
238 238
 
239 239
     /**
240
-    * Sets a message for the cache operation.
241
-    *
242
-    * @param string  $message
243
-    * @param boolean $success
244
-    * @return void
245
-    */
240
+     * Sets a message for the cache operation.
241
+     *
242
+     * @param string  $message
243
+     * @param boolean $success
244
+     * @return void
245
+     */
246 246
     private function setMessage(string $message, bool $success): void
247 247
     {
248 248
         $this->message = $message;
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
     }
251 251
 
252 252
     /**
253
-    * Retrieves the message from the last operation.
254
-    * 
255
-    * @return string
256
-    */
253
+     * Retrieves the message from the last operation.
254
+     * 
255
+     * @return string
256
+     */
257 257
     public function getMessage(): string
258 258
     {
259 259
         return $this->message;
Please login to merge, or discard this patch.
tests/Feature/RedisOptionBuilderFeatureTest.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 class RedisOptionBuilderFeatureTest extends TestCase
6 6
 {
7
-  public function test_it_builds_redis_options()
8
-  {
7
+    public function test_it_builds_redis_options()
8
+    {
9 9
     $options = OptionBuilder::forRedis()
10
-      ->setNamespace('app:')
11
-      ->expirationTime('2 hours')
12
-      ->flushAfter('1 day')
13
-      ->build();
10
+        ->setNamespace('app:')
11
+        ->expirationTime('2 hours')
12
+        ->flushAfter('1 day')
13
+        ->build();
14 14
 
15 15
     $this->assertArrayHasKey('namespace', $options);
16 16
     $this->assertArrayHasKey('expirationTime', $options);
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
     $this->assertSame('app:', $options['namespace']);
20 20
     $this->assertSame('2 hours', $options['expirationTime']);
21 21
     $this->assertSame('1 day', $options['flushAfter']);
22
-  }
22
+    }
23 23
 
24
-  public function test_it_allows_timebuilder_for_redis()
25
-  {
24
+    public function test_it_allows_timebuilder_for_redis()
25
+    {
26 26
     $options = OptionBuilder::forRedis()
27
-      ->expirationTime()->minute(30)
28
-      ->flushAfter()->day(2)
29
-      ->build();
27
+        ->expirationTime()->minute(30)
28
+        ->flushAfter()->day(2)
29
+        ->build();
30 30
 
31 31
     $this->assertSame('30 minutes', $options['expirationTime']);
32 32
     $this->assertSame('2 days', $options['flushAfter']);
33
-  }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
tests/Feature/DatabaseOptionBuilderFeatureTest.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@  discard block
 block discarded – undo
4 4
 
5 5
 class DatabaseOptionBuilderFeatureTest extends TestCase
6 6
 {
7
-  public function test_it_builds_database_options()
8
-  {
7
+    public function test_it_builds_database_options()
8
+    {
9 9
     $options = OptionBuilder::forDatabase()
10
-      ->table('cache_items')
11
-      ->expirationTime('12 hours')
12
-      ->flushAfter('7 days')
13
-      ->build();
10
+        ->table('cache_items')
11
+        ->expirationTime('12 hours')
12
+        ->flushAfter('7 days')
13
+        ->build();
14 14
 
15 15
     $this->assertArrayHasKey('table', $options);
16 16
     $this->assertArrayHasKey('expirationTime', $options);
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
     $this->assertSame('cache_items', $options['table']);
20 20
     $this->assertSame('12 hours', $options['expirationTime']);
21 21
     $this->assertSame('7 days', $options['flushAfter']);
22
-  }
22
+    }
23 23
 
24
-  public function test_it_allows_timebuilder_for_database()
25
-  {
24
+    public function test_it_allows_timebuilder_for_database()
25
+    {
26 26
     $options = OptionBuilder::forDatabase()
27
-      ->expirationTime()->hour(6)
28
-      ->flushAfter()->week(1)
29
-      ->build();
27
+        ->expirationTime()->hour(6)
28
+        ->flushAfter()->week(1)
29
+        ->build();
30 30
 
31 31
     $this->assertSame('6 hours', $options['expirationTime']);
32 32
     $this->assertSame('1 weeks', $options['flushAfter']);
33
-  }
33
+    }
34 34
 }
Please login to merge, or discard this patch.
tests/Unit/RedisOptionBuilderStoreTest.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -8,38 +8,38 @@  discard block
 block discarded – undo
8 8
 
9 9
 class RedisOptionBuilderStoreTest extends TestCase
10 10
 {
11
-  private ?PredisClient $client = null;
11
+    private ?PredisClient $client = null;
12 12
 
13
-  protected function setUp(): void
14
-  {
13
+    protected function setUp(): void
14
+    {
15 15
     // Try to connect to Redis; skip if not available
16 16
     try {
17
-      PredisAutoloader::register();
18
-      $this->client = new PredisClient([
17
+        PredisAutoloader::register();
18
+        $this->client = new PredisClient([
19 19
         'scheme' => 'tcp',
20 20
         'host'   => REDIS_CONNECTION_CONFIG['REDIS_HOST'] ?? '127.0.0.1',
21 21
         'port'   => REDIS_CONNECTION_CONFIG['REDIS_PORT'] ?? 6379,
22
-      ]);
23
-      $this->client->connect();
24
-      // simple call to verify
25
-      $this->client->ping();
22
+        ]);
23
+        $this->client->connect();
24
+        // simple call to verify
25
+        $this->client->ping();
26 26
     } catch (\Throwable $e) {
27
-      $this->markTestSkipped('Redis not available: ' . $e->getMessage());
27
+        $this->markTestSkipped('Redis not available: ' . $e->getMessage());
28
+    }
28 29
     }
29
-  }
30 30
 
31
-  protected function tearDown(): void
32
-  {
31
+    protected function tearDown(): void
32
+    {
33 33
     if ($this->client) {
34
-      $this->client->disconnect();
34
+        $this->client->disconnect();
35
+    }
35 36
     }
36
-  }
37 37
 
38
-  public function test_redis_store_uses_namespace_from_option_builder()
39
-  {
38
+    public function test_redis_store_uses_namespace_from_option_builder()
39
+    {
40 40
     $options = OptionBuilder::forRedis()
41
-      ->setNamespace('app:')
42
-      ->build();
41
+        ->setNamespace('app:')
42
+        ->build();
43 43
 
44 44
     $cache = new Cacheer($options);
45 45
     $cache->setDriver()->useRedisDriver();
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 
56 56
     $read = $cache->getCache($key);
57 57
     $this->assertEquals($data, $read);
58
-  }
58
+    }
59 59
 }
60 60
 
Please login to merge, or discard this patch.
tests/Unit/RedisOptionBuilderTTLAndFlushTest.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -9,37 +9,37 @@  discard block
 block discarded – undo
9 9
 
10 10
 class RedisOptionBuilderTTLAndFlushTest extends TestCase
11 11
 {
12
-  private ?PredisClient $client = null;
12
+    private ?PredisClient $client = null;
13 13
 
14
-  protected function setUp(): void
15
-  {
14
+    protected function setUp(): void
15
+    {
16 16
     try {
17
-      PredisAutoloader::register();
18
-      $this->client = new PredisClient([
17
+        PredisAutoloader::register();
18
+        $this->client = new PredisClient([
19 19
         'scheme' => 'tcp',
20 20
         'host'   => REDIS_CONNECTION_CONFIG['REDIS_HOST'] ?? '127.0.0.1',
21 21
         'port'   => REDIS_CONNECTION_CONFIG['REDIS_PORT'] ?? 6379,
22
-      ]);
23
-      $this->client->connect();
24
-      $this->client->ping();
22
+        ]);
23
+        $this->client->connect();
24
+        $this->client->ping();
25 25
     } catch (\Throwable $e) {
26
-      $this->markTestSkipped('Redis not available: ' . $e->getMessage());
26
+        $this->markTestSkipped('Redis not available: ' . $e->getMessage());
27
+    }
27 28
     }
28
-  }
29 29
 
30
-  protected function tearDown(): void
31
-  {
30
+    protected function tearDown(): void
31
+    {
32 32
     if ($this->client) {
33
-      $this->client->disconnect();
33
+        $this->client->disconnect();
34
+    }
34 35
     }
35
-  }
36 36
 
37
-  public function test_expiration_time_from_options_sets_default_ttl()
38
-  {
37
+    public function test_expiration_time_from_options_sets_default_ttl()
38
+    {
39 39
     $options = OptionBuilder::forRedis()
40
-      ->setNamespace('app:')
41
-      ->expirationTime('1 seconds')
42
-      ->build();
40
+        ->setNamespace('app:')
41
+        ->expirationTime('1 seconds')
42
+        ->build();
43 43
 
44 44
     $cache = new Cacheer($options);
45 45
     $cache->setDriver()->useRedisDriver();
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 
51 51
     sleep(2);
52 52
     $this->assertNull($cache->getCache($key));
53
-  }
53
+    }
54 54
 
55
-  public function test_flush_after_from_options_triggers_auto_flush()
56
-  {
55
+    public function test_flush_after_from_options_triggers_auto_flush()
56
+    {
57 57
     $options = OptionBuilder::forRedis()
58
-      ->setNamespace('app:')
59
-      ->flushAfter('1 seconds')
60
-      ->build();
58
+        ->setNamespace('app:')
59
+        ->flushAfter('1 seconds')
60
+        ->build();
61 61
 
62 62
     $flushFile = FlushHelper::pathFor('redis', 'app:');
63 63
     file_put_contents($flushFile, (string) (time() - 3600));
@@ -71,5 +71,5 @@  discard block
 block discarded – undo
71 71
     $cache = new Cacheer($options);
72 72
     $cache->setDriver()->useRedisDriver();
73 73
     $this->assertFalse((bool)$this->client->exists('app:to_be_flushed'));
74
-  }
74
+    }
75 75
 }
Please login to merge, or discard this patch.
tests/Unit/DatabaseOptionBuilderStoreTest.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 class DatabaseOptionBuilderStoreTest extends TestCase
9 9
 {
10
-  private ?PDO $pdo = null;
11
-  private string $table = 'cache_items';
10
+    private ?PDO $pdo = null;
11
+    private string $table = 'cache_items';
12 12
 
13
-  protected function setUp(): void
14
-  {
13
+    protected function setUp(): void
14
+    {
15 15
     // Ensure SQLite connection and create a custom table for this test
16 16
     $this->pdo = Connect::getInstance();
17 17
 
@@ -30,20 +30,20 @@  discard block
 block discarded – undo
30 30
     CREATE INDEX IF NOT EXISTS idx_{$this->table}_expirationTime ON {$this->table} (expirationTime);
31 31
     CREATE INDEX IF NOT EXISTS idx_{$this->table}_key_namespace ON {$this->table} (cacheKey, cacheNamespace);
32 32
     ");
33
-  }
33
+    }
34 34
 
35
-  protected function tearDown(): void
36
-  {
35
+    protected function tearDown(): void
36
+    {
37 37
     if ($this->pdo instanceof PDO) {
38
-      $this->pdo->exec("DROP TABLE IF EXISTS {$this->table}");
38
+        $this->pdo->exec("DROP TABLE IF EXISTS {$this->table}");
39
+    }
39 40
     }
40
-  }
41 41
 
42
-  public function test_database_store_uses_custom_table_from_option_builder()
43
-  {
42
+    public function test_database_store_uses_custom_table_from_option_builder()
43
+    {
44 44
     $options = OptionBuilder::forDatabase()
45
-      ->table($this->table)
46
-      ->build();
45
+        ->table($this->table)
46
+        ->build();
47 47
 
48 48
     $cache = new Cacheer($options);
49 49
     $cache->setDriver()->useDatabaseDriver();
@@ -67,6 +67,6 @@  discard block
 block discarded – undo
67 67
     // And ensure Cacheer can read it back through the store
68 68
     $read = $cache->getCache($key);
69 69
     $this->assertEquals($data, $read);
70
-  }
70
+    }
71 71
 }
72 72
 
Please login to merge, or discard this patch.