Passed
Pull Request — main (#45)
by Sílvio
03:10
created
src/Helpers/CacheRedisHelper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
   */
20 20
   public static function serialize(mixed $data, bool $serialize = true)
21 21
   {
22
-    if($serialize) {
22
+    if ($serialize) {
23 23
       return serialize($data);
24 24
     }
25 25
 
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 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)
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)
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)
40 40
     {
41 41
         CacheerHelper::validateCacheItem(
@@ -45,27 +45,27 @@  discard block
 block discarded – undo
45 45
     }
46 46
 
47 47
     /**
48
-    * Merges cache data with existing data.
49
-    * 
50
-    * @param array $options
51
-    * @return array
52
-    */
48
+     * Merges cache data with existing data.
49
+     * 
50
+     * @param array $options
51
+     * @return array
52
+     */
53 53
     public static function mergeCacheData($cacheData)
54 54
     {
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)
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)
66
+    {
67
+        return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
68
+    }
69 69
 
70 70
 }
71 71
 
Please login to merge, or discard this patch.
src/CacheStore/CacheManager/RedisCacheManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
   */
38 38
   private static function auth()
39 39
   {
40
-    if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
40
+    if (is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
41 41
       self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
42 42
     }
43 43
   }
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@
 block discarded – undo
14 14
 class RedisCacheManager
15 15
 {
16 16
 
17
-  /** @var Predis\Client */
18
-  private static $redis;
19
-
20
-  /** @param string $namespace */
21
-  private static $namespace;
22
-
23
-  /**
24
-   * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG.
25
-   * 
26
-  * @return Client
27
-  */
28
-  public static function connect()
29
-  {
17
+    /** @var Predis\Client */
18
+    private static $redis;
19
+
20
+    /** @param string $namespace */
21
+    private static $namespace;
22
+
23
+    /**
24
+     * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG.
25
+     * 
26
+     * @return Client
27
+     */
28
+    public static function connect()
29
+    {
30 30
     Autoloader::register();
31 31
     self::$redis = new Client([
32
-      'scheme' => 'tcp',
33
-      'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'],
34
-      'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'],
35
-      'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'],
36
-      'database' => 0
32
+        'scheme' => 'tcp',
33
+        'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'],
34
+        'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'],
35
+        'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'],
36
+        'database' => 0
37 37
     ]);
38 38
     self::auth();
39 39
     self::$namespace = REDIS_CONNECTION_CONFIG['REDIS_NAMESPACE'] ?? 'Cache';
40 40
     return self::$redis;
41
-  }
42
-
43
-  /**
44
-  * Authenticates the Redis connection if a password is provided in the configuration.
45
-  *
46
-  * @return void
47
-  */
48
-  private static function auth()
49
-  {
41
+    }
42
+
43
+    /**
44
+     * Authenticates the Redis connection if a password is provided in the configuration.
45
+     *
46
+     * @return void
47
+     */
48
+    private static function auth()
49
+    {
50 50
     if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') {
51
-      self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
51
+        self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']);
52
+    }
52 53
     }
53
-  }
54 54
 
55 55
 }
Please login to merge, or discard this patch.
Examples/example08.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
     echo "Cache Found: ";
24 24
     print_r($Cacheer->getCache($cacheKey));
25 25
 } else {
26
-  echo $Cacheer->getMessage();
26
+    echo $Cacheer->getMessage();
27 27
 }
28 28
 
29 29
 // Renovando os dados do cache
30 30
 $Cacheer->renewCache($cacheKey, 3600);
31 31
 
32 32
 if($Cacheer->isSuccess()){
33
-  echo $Cacheer->getMessage() . PHP_EOL;
33
+    echo $Cacheer->getMessage() . PHP_EOL;
34 34
 } else {
35
-  echo $Cacheer->getMessage() . PHP_EOL;
35
+    echo $Cacheer->getMessage() . PHP_EOL;
36 36
 
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $Cacheer->putCache($cacheKey, $userProfile, ttl: 300);
20 20
 
21 21
 // Recuperando dados do cache
22
-if($Cacheer->isSuccess()){
22
+if ($Cacheer->isSuccess()) {
23 23
     echo "Cache Found: ";
24 24
     print_r($Cacheer->getCache($cacheKey));
25 25
 } else {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 // Renovando os dados do cache
30 30
 $Cacheer->renewCache($cacheKey, 3600);
31 31
 
32
-if($Cacheer->isSuccess()){
32
+if ($Cacheer->isSuccess()) {
33 33
   echo $Cacheer->getMessage() . PHP_EOL;
34 34
 } else {
35 35
   echo $Cacheer->getMessage() . PHP_EOL;
Please login to merge, or discard this patch.
Examples/example07.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     echo "Cache Found: ";
30 30
     print_r($Cacheer->getCache($cacheKey));
31 31
 } else {
32
-  echo $Cacheer->getMessage();
32
+    echo $Cacheer->getMessage();
33 33
 }
34 34
 
35 35
 
@@ -40,6 +40,6 @@  discard block
 block discarded – undo
40 40
     echo $Cacheer->getMessage() . PHP_EOL;
41 41
     print_r($Cacheer->getCache($cacheKey));
42 42
 } else {
43
-  echo $Cacheer->getMessage();
43
+    echo $Cacheer->getMessage();
44 44
 }
45 45
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 $Cacheer->putCache($cacheKey, $userProfile);
26 26
 
27 27
 // Recuperando dados do cache
28
-if($Cacheer->isSuccess()){
28
+if ($Cacheer->isSuccess()) {
29 29
     echo "Cache Found: ";
30 30
     print_r($Cacheer->getCache($cacheKey));
31 31
 } else {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 // Mesclando os dados
37 37
 $Cacheer->appendCache($cacheKey, $userProfile02);
38 38
 
39
-if($Cacheer->isSuccess()){
39
+if ($Cacheer->isSuccess()) {
40 40
     echo $Cacheer->getMessage() . PHP_EOL;
41 41
     print_r($Cacheer->getCache($cacheKey));
42 42
 } else {
Please login to merge, or discard this patch.
src/CacheStore/CacheManager/OptionBuilders/FileOptionBuilder.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
       return $this;
46 46
     }
47 47
 
48
-    return new TimeBuilder(function ($formattedTime){
48
+    return new TimeBuilder(function($formattedTime) {
49 49
       $this->expirationTime = $formattedTime;
50 50
     }, $this);
51 51
   }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
       return $this;
63 63
     }
64 64
 
65
-    return new TimeBuilder(function ($formattedTime){
65
+    return new TimeBuilder(function($formattedTime) {
66 66
       $this->flushAfter = $formattedTime;
67 67
     }, $this);
68 68
   }
Please login to merge, or discard this patch.
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -13,119 +13,119 @@
 block discarded – undo
13 13
  */
14 14
 class FileOptionBuilder
15 15
 {
16
-  /** @param null|string $cacheDir */
17
-  private ?string $cacheDir = null;
18
-
19
-  /** @param null|string $expirationTime */
20
-  private ?string $expirationTime = null;
21
-
22
-  /** @param null|string $flushAfter */
23
-  private ?string $flushAfter = null;
24
-
25
-  /** @param array $options */
26
-  private array $options = [];
27
-
28
-  /**
29
-  * Directory where cache files will be stored.
30
-  *
31
-  * @param string $cacheDir
32
-  * @return $this
33
-  */
34
-  public function dir(string $cacheDir)
35
-  {
16
+    /** @param null|string $cacheDir */
17
+    private ?string $cacheDir = null;
18
+
19
+    /** @param null|string $expirationTime */
20
+    private ?string $expirationTime = null;
21
+
22
+    /** @param null|string $flushAfter */
23
+    private ?string $flushAfter = null;
24
+
25
+    /** @param array $options */
26
+    private array $options = [];
27
+
28
+    /**
29
+     * Directory where cache files will be stored.
30
+     *
31
+     * @param string $cacheDir
32
+     * @return $this
33
+     */
34
+    public function dir(string $cacheDir)
35
+    {
36 36
     $this->cacheDir = $cacheDir;
37 37
     return $this;
38
-  }
38
+    }
39 39
 
40
-  /**
41
-  * Sets the expiration time for cache items.
42
-  * @param ?string $expirationTime
43
-  * @return $this|TimeBuilder
44
-  */
45
-  public function expirationTime(?string $expirationTime = null)
46
-  {
40
+    /**
41
+     * Sets the expiration time for cache items.
42
+     * @param ?string $expirationTime
43
+     * @return $this|TimeBuilder
44
+     */
45
+    public function expirationTime(?string $expirationTime = null)
46
+    {
47 47
 
48 48
     if (!is_null($expirationTime)) {
49
-      $this->expirationTime = $expirationTime;
50
-      return $this;
49
+        $this->expirationTime = $expirationTime;
50
+        return $this;
51 51
     }
52 52
 
53 53
     return new TimeBuilder(function ($formattedTime){
54
-      $this->expirationTime = $formattedTime;
54
+        $this->expirationTime = $formattedTime;
55 55
     }, $this);
56
-  }
57
-
58
-  /**
59
-  * Sets the flush time for cache items.
60
-  * This is the time after which the cache will be flushed.
61
-  *
62
-  * @param ?string $flushAfter
63
-  * @return $this|TimeBuilder
64
-  */
65
-  public function flushAfter(?string $flushAfter = null)
66
-  {
56
+    }
57
+
58
+    /**
59
+     * Sets the flush time for cache items.
60
+     * This is the time after which the cache will be flushed.
61
+     *
62
+     * @param ?string $flushAfter
63
+     * @return $this|TimeBuilder
64
+     */
65
+    public function flushAfter(?string $flushAfter = null)
66
+    {
67 67
 
68 68
     if (!is_null($flushAfter)) {
69
-      $this->flushAfter = mb_strtolower($flushAfter, 'UTF-8');
70
-      return $this;
69
+        $this->flushAfter = mb_strtolower($flushAfter, 'UTF-8');
70
+        return $this;
71 71
     }
72 72
 
73 73
     return new TimeBuilder(function ($formattedTime){
74
-      $this->flushAfter = $formattedTime;
74
+        $this->flushAfter = $formattedTime;
75 75
     }, $this);
76
-  }
77
-
78
-  /**
79
-  * Builds the options array for file cache configuration.
80
-  * @return array
81
-  */
82
-  public function build()
83
-  {
76
+    }
77
+
78
+    /**
79
+     * Builds the options array for file cache configuration.
80
+     * @return array
81
+     */
82
+    public function build()
83
+    {
84 84
     return $this->validated();
85
-  }
86
-
87
-  /**
88
-  * Validates the properties and returns an array of options.
89
-  * It checks if each property is valid and not null, then adds it to the options
90
-  *
91
-  * @return array
92
-  */
93
-  private function validated()
94
-  {
85
+    }
86
+
87
+    /**
88
+     * Validates the properties and returns an array of options.
89
+     * It checks if each property is valid and not null, then adds it to the options
90
+     *
91
+     * @return array
92
+     */
93
+    private function validated()
94
+    {
95 95
     foreach ($this->properties() as $key => $value) {
96 96
         if ($this->isValidAndNotNull($value)) {
97 97
             $this->options[$key] = $value;
98 98
         }
99 99
     }
100 100
     return $this->options;
101
-  }
102
-
103
-  /**
104
-  * Checks if the provided data is valid and not null.
105
-  * This is used to ensure that only valid options are included in the final configuration.
106
-  *
107
-  * @param mixed $data
108
-  * @return bool
109
-  */
110
-  private function isValidAndNotNull(mixed $data)
111
-  {
101
+    }
102
+
103
+    /**
104
+     * Checks if the provided data is valid and not null.
105
+     * This is used to ensure that only valid options are included in the final configuration.
106
+     *
107
+     * @param mixed $data
108
+     * @return bool
109
+     */
110
+    private function isValidAndNotNull(mixed $data)
111
+    {
112 112
     return !empty($data) ? true : false;
113
-  }
114
-
115
-  /**
116
-  * Returns the properties of the FileOptionBuilder instance.
117
-  * This method is used to gather the current state of the instance's properties.
118
-  *
119
-  * @return array
120
-  */
121
-  private function properties()
122
-  {
113
+    }
114
+
115
+    /**
116
+     * Returns the properties of the FileOptionBuilder instance.
117
+     * This method is used to gather the current state of the instance's properties.
118
+     *
119
+     * @return array
120
+     */
121
+    private function properties()
122
+    {
123 123
     $properties = [
124
-      'cacheDir' => $this->cacheDir,
125
-      'expirationTime' => $this->expirationTime,
126
-      'flushAfter' => $this->flushAfter
124
+        'cacheDir' => $this->cacheDir,
125
+        'expirationTime' => $this->expirationTime,
126
+        'flushAfter' => $this->flushAfter
127 127
     ];
128 128
 
129 129
     return $properties;
130
-  }
130
+    }
131 131
 }
Please login to merge, or discard this patch.
tests/Unit/FileCacheStoreTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $this->cache->flushCache();
260 260
 
261
-        $value = $this->cache->remember('remember_test_key', 60, function () {
261
+        $value = $this->cache->remember('remember_test_key', 60, function() {
262 262
             return 'valor_teste';
263 263
         });
264 264
 
265 265
         $this->assertEquals('valor_teste', $value);
266 266
 
267
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function (){
267
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
268 268
             return 'novo_valor';
269 269
         });
270 270
 
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $this->cache->flushCache();
278 278
 
279
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
279
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
280 280
             return 'valor_eterno';
281 281
         });
282 282
         $this->assertEquals('valor_eterno', $value);
283 283
 
284
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
284
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
285 285
             return 'novo_valor';
286 286
         });
287 287
 
Please login to merge, or discard this patch.
tests/Unit/DatabaseCacheStoreTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 
233 233
     public function test_remember_saves_and_recover_values()
234 234
     {
235
-        $value = $this->cache->remember('remember_test_key', 60, function () {
235
+        $value = $this->cache->remember('remember_test_key', 60, function() {
236 236
             return 'valor_teste';
237 237
         });
238 238
 
239 239
         $this->assertEquals('valor_teste', $value);
240 240
 
241
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function (){
241
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
242 242
             return 'novo_valor';
243 243
         });
244 244
 
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
     public function test_remember_forever_saves_value_indefinitely()
250 250
     {
251 251
 
252
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
252
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
253 253
             return 'valor_eterno';
254 254
         });
255 255
         $this->assertEquals('valor_eterno', $value);
256 256
 
257
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
257
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
258 258
             return 'novo_valor';
259 259
         });
260 260
 
Please login to merge, or discard this patch.
tests/Unit/RedisCacheStoreTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $this->cache->flushCache();
260 260
 
261
-        $value = $this->cache->remember('remember_test_key', 60, function () {
261
+        $value = $this->cache->remember('remember_test_key', 60, function() {
262 262
             return 'valor_teste';
263 263
         });
264 264
 
265 265
         $this->assertEquals('valor_teste', $value);
266 266
 
267
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function (){
267
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
268 268
             return 'novo_valor';
269 269
         });
270 270
 
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $this->cache->flushCache();
278 278
 
279
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
279
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
280 280
             return 'valor_eterno';
281 281
         });
282 282
         $this->assertEquals('valor_eterno', $value);
283 283
 
284
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
284
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
285 285
             return 'novo_valor';
286 286
         });
287 287
 
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -7,27 +7,27 @@  discard block
 block discarded – undo
7 7
 class RedisCacheStoreTest extends TestCase
8 8
 {
9 9
 
10
-  /** @var Cacheer */
11
-  private $cache;
10
+    /** @var Cacheer */
11
+    private $cache;
12 12
 
13
-  protected function setUp(): void
14
-  {
13
+    protected function setUp(): void
14
+    {
15 15
     $this->cache = new Cacheer();
16 16
     $this->cache->setDriver()->useRedisDriver();
17
-  }
17
+    }
18 18
 
19
-  protected function tearDown(): void
20
-  {
19
+    protected function tearDown(): void
20
+    {
21 21
     $this->cache->flushCache();
22
-  }
22
+    }
23 23
 
24
-  public function testUsingRedisDriverSetsProperInstance()
25
-  {
24
+    public function testUsingRedisDriverSetsProperInstance()
25
+    {
26 26
     $this->assertInstanceOf(RedisCacheStore::class, $this->cache->cacheStore);
27
-  }
27
+    }
28 28
 
29
-  public function testPutCacheInRedis()
30
-  {
29
+    public function testPutCacheInRedis()
30
+    {
31 31
     $cacheKey = 'test_key';
32 32
     $cacheData = ['name' => 'Sílvio Silva', 'role' => 'Developer'];
33 33
 
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
     $this->assertNotEmpty($this->cache->getCache($cacheKey));
38 38
     $this->assertEquals($cacheData, $this->cache->getCache($cacheKey));
39 39
 
40
-  }
40
+    }
41 41
 
42
-  public function testGetCacheFromRedis()
43
-  {
42
+    public function testGetCacheFromRedis()
43
+    {
44 44
     $cacheKey = 'test_key';
45 45
     $cacheData = ['name' => 'Sílvio Silva', 'role' => 'Developer'];
46 46
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     $data = $this->cache->getCache($cacheKey);
52 52
     $this->assertNotEmpty($data);
53 53
     $this->assertEquals($cacheData, $data);
54
-  }
54
+    }
55 55
 
56
-  public function testExpiredCacheInRedis()
57
-  {
56
+    public function testExpiredCacheInRedis()
57
+    {
58 58
     $cacheKey = 'expired_key';
59 59
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
60 60
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     $this->assertEquals("Cache stored successfully", $this->cache->getMessage());
65 65
     $this->assertEmpty($this->cache->getCache($cacheKey));
66 66
     $this->assertFalse($this->cache->isSuccess());
67
-  }
67
+    }
68 68
 
69
-  public function testOverwriteExistingCacheInRedis()
70
-  {
69
+    public function testOverwriteExistingCacheInRedis()
70
+    {
71 71
     $cacheKey = 'overwrite_key';
72 72
     $initialCacheData = ['name' => 'Initial Data', 'email' => '[email protected]'];
73 73
     $newCacheData = ['name' => 'New Data', 'email' => '[email protected]'];
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
     $this->cache->appendCache($cacheKey, $newCacheData);
79 79
     $this->assertEquals("Cache appended successfully", $this->cache->getMessage());
80 80
     $this->assertEquals($newCacheData, $this->cache->getCache($cacheKey));
81
-  }
81
+    }
82 82
 
83
-  public function testPutManyCacheItemsInRedis()
84
-  {
85
-     $items = [
83
+    public function testPutManyCacheItemsInRedis()
84
+    {
85
+        $items = [
86 86
             [
87 87
                 'cacheKey' => 'user_1_profile',
88 88
                 'cacheData' => [
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     foreach ($items as $item) {
108 108
             $this->assertEquals($item['cacheData'], $this->cache->getCache($item['cacheKey']));
109 109
         }
110
-  }
110
+    }
111 111
 
112
-      public function testAppendCacheWithNamespaceInRedis()
112
+        public function testAppendCacheWithNamespaceInRedis()
113 113
     {
114 114
         $cacheKey = 'test_append_key_ns';
115 115
         $namespace = 'test_namespace';
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $this->assertEquals($expectedData, $cachedData);
133 133
     }
134 134
 
135
-      public function testDataOutputShouldBeOfTypeArray()
135
+        public function testDataOutputShouldBeOfTypeArray()
136 136
     {
137 137
 
138 138
         $this->cache->useFormatter();
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         $this->assertJson($cacheOutput);
179 179
     }
180 180
 
181
-      public function testClearCacheDataFromRedis()
181
+        public function testClearCacheDataFromRedis()
182 182
     {
183 183
         $cacheKey = 'test_key';
184 184
         $data = 'test_data';
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
         $this->assertEmpty($this->cache->getCache($cacheKey));
194 194
     }
195 195
 
196
-  public function testFlushCacheDataFromRedis()
197
-  {
196
+    public function testFlushCacheDataFromRedis()
197
+    {
198 198
         $key1 = 'test_key1';
199 199
         $data1 = 'test_data1';
200 200
 
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
         $this->assertEquals("Cache flushed successfully", $this->cache->getMessage());
213 213
     }
214 214
 
215
-  public function testHasCacheFromRedis()
216
-  {
215
+    public function testHasCacheFromRedis()
216
+    {
217 217
     $cacheKey = 'test_key';
218 218
     $cacheData = ['name' => 'Sílvio Silva', 'role' => 'Developer'];
219 219
 
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 
222 222
     $this->assertEquals("Cache stored successfully", $this->cache->getMessage());
223 223
     $this->assertTrue($this->cache->isSuccess());
224
-  }
224
+    }
225 225
 
226
-  public function testRenewCacheFromRedis()
227
-  {
226
+    public function testRenewCacheFromRedis()
227
+    {
228 228
     $cacheKey = 'expired_key';
229 229
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
230 230
 
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
     $this->cache->renewCache($cacheKey, 7200);
240 240
     $this->assertTrue($this->cache->isSuccess());
241 241
     $this->assertNotEmpty($this->cache->getCache($cacheKey));
242
-  }
242
+    }
243 243
 
244 244
     public function testRenewCacheWithNamespaceFromRedis()
245
-  {
245
+    {
246 246
     $cacheKey = 'expired_key';
247 247
     $namespace = 'expired_namespace';
248 248
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
     $this->cache->renewCache($cacheKey, 7200, $namespace);
257 257
     $this->assertTrue($this->cache->isSuccess());
258 258
     $this->assertNotEmpty($this->cache->getCache($cacheKey, $namespace));
259
-  }
259
+    }
260 260
 
261
-  public function test_remember_saves_and_recover_values() 
261
+    public function test_remember_saves_and_recover_values() 
262 262
     {
263 263
         $this->cache->flushCache();
264 264
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     }
294 294
 
295 295
 
296
-      public function test_get_and_forget()
296
+        public function test_get_and_forget()
297 297
     {
298 298
         $cacheKey = 'cache_key_test';
299 299
         $this->cache->putCache($cacheKey, 10);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         $this->assertNull($noCacheData);
315 315
     }
316 316
 
317
-      public function test_store_if_not_present_with_add_function()
317
+        public function test_store_if_not_present_with_add_function()
318 318
     {
319 319
         $existentKey = 'cache_key_test';
320 320
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
     }
340 340
 
341
-      public function test_increment_function() {
341
+        public function test_increment_function() {
342 342
 
343 343
         $cacheKey = 'test_increment';
344 344
         $cacheData = 2025;
Please login to merge, or discard this patch.
tests/Unit/ArrayCacheStoreTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
     {
259 259
         $this->cache->flushCache();
260 260
 
261
-        $value = $this->cache->remember('remember_test_key', 60, function () {
261
+        $value = $this->cache->remember('remember_test_key', 60, function() {
262 262
             return 'valor_teste';
263 263
         });
264 264
 
265 265
         $this->assertEquals('valor_teste', $value);
266 266
 
267
-        $cachedValue = $this->cache->remember('remember_test_key', 60, function (){
267
+        $cachedValue = $this->cache->remember('remember_test_key', 60, function() {
268 268
             return 'novo_valor';
269 269
         });
270 270
 
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $this->cache->flushCache();
278 278
 
279
-        $value = $this->cache->rememberForever('remember_forever_key', function () {
279
+        $value = $this->cache->rememberForever('remember_forever_key', function() {
280 280
             return 'valor_eterno';
281 281
         });
282 282
         $this->assertEquals('valor_eterno', $value);
283 283
 
284
-        $cachedValue = $this->cache->rememberForever('remember_forever_key', function () {
284
+        $cachedValue = $this->cache->rememberForever('remember_forever_key', function() {
285 285
             return 'novo_valor';
286 286
         });
287 287
 
Please login to merge, or discard this patch.
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -7,40 +7,40 @@  discard block
 block discarded – undo
7 7
 class ArrayCacheStoreTest extends TestCase
8 8
 {
9 9
 
10
-  private $cache;
10
+    private $cache;
11 11
 
12
-  protected function setUp(): void
13
-  {
12
+    protected function setUp(): void
13
+    {
14 14
     $this->cache = new Cacheer();
15 15
     $this->cache->setDriver()->useArrayDriver();
16 16
     $this->cache->setConfig()->setTimeZone('America/Toronto');
17
-  }
17
+    }
18 18
 
19
-  protected function tearDown(): void
20
-  {
19
+    protected function tearDown(): void
20
+    {
21 21
     $this->cache->flushCache();
22
-  }
22
+    }
23 23
 
24 24
     public function testUsingArrayDriverSetsProperInstance()
25
-  {
25
+    {
26 26
     $this->assertInstanceOf(ArrayCacheStore::class, $this->cache->cacheStore);
27
-  }
27
+    }
28 28
 
29
-  public function testPutAndGetCacheInArray()
30
-  {
31
-      $cacheKey = 'test_key';
32
-      $cacheData = ['name' => 'John Doe', 'email' => '[email protected]'];
29
+    public function testPutAndGetCacheInArray()
30
+    {
31
+        $cacheKey = 'test_key';
32
+        $cacheData = ['name' => 'John Doe', 'email' => '[email protected]'];
33 33
       
34
-      $this->cache->putCache($cacheKey, $cacheData, '', 3600);
34
+        $this->cache->putCache($cacheKey, $cacheData, '', 3600);
35 35
 
36
-      $result = $this->cache->getCache($cacheKey);
36
+        $result = $this->cache->getCache($cacheKey);
37 37
 
38
-      $this->assertNotEmpty($result);
39
-      $this->assertEquals($cacheData, $result);
40
-  }
38
+        $this->assertNotEmpty($result);
39
+        $this->assertEquals($cacheData, $result);
40
+    }
41 41
 
42
-  public function testExpiredCacheInArray()
43
-  {
42
+    public function testExpiredCacheInArray()
43
+    {
44 44
     $cacheKey = 'expired_key';
45 45
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
46 46
 
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
     $this->assertEquals("Cache stored successfully", $this->cache->getMessage());
51 51
     $this->assertEmpty($this->cache->getCache($cacheKey));
52 52
     $this->assertFalse($this->cache->isSuccess());
53
-  }
53
+    }
54 54
 
55 55
 
56
-  public function testOverwriteExistingCacheInArray()
57
-  {
56
+    public function testOverwriteExistingCacheInArray()
57
+    {
58 58
     $cacheKey = 'overwrite_key';
59 59
     $initialCacheData = ['name' => 'Initial Data', 'email' => '[email protected]'];
60 60
     $newCacheData = ['name' => 'New Data', 'email' => '[email protected]'];
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
     $this->cache->appendCache($cacheKey, $newCacheData);
66 66
     $this->assertEquals("Cache appended successfully", $this->cache->getMessage());
67 67
     $this->assertEquals($newCacheData, $this->cache->getCache($cacheKey));
68
-  }
68
+    }
69 69
 
70 70
 
71
-  public function testPutManyCacheItemsInArray()
72
-  {
73
-     $items = [
71
+    public function testPutManyCacheItemsInArray()
72
+    {
73
+        $items = [
74 74
             [
75 75
                 'cacheKey' => 'user_1_profile',
76 76
                 'cacheData' => [
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
           
97 97
             $this->assertEquals($item['cacheData'], $this->cache->getCache($item['cacheKey']));
98 98
         }
99
-  }
99
+    }
100 100
 
101
-  public function testHasCacheFromArray()
102
-  {
101
+    public function testHasCacheFromArray()
102
+    {
103 103
     $cacheKey = 'test_key';
104 104
     $cacheData = ['name' => 'Sílvio Silva', 'role' => 'Developer'];
105 105
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
     $this->cache->has($cacheKey);
112 112
     $this->assertTrue($this->cache->isSuccess());
113
-  }
113
+    }
114 114
 
115 115
     public function testRenewCacheFromArray()
116
-  {
116
+    {
117 117
     $cacheKey = 'expired_key';
118 118
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
119 119
 
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
     $this->cache->renewCache($cacheKey, 7200);
129 129
     $this->assertTrue($this->cache->isSuccess());
130 130
     $this->assertNotEmpty($this->cache->getCache($cacheKey));
131
-  }
131
+    }
132 132
 
133
-      public function testRenewCacheWithNamespaceFromArray()
134
-  {
133
+        public function testRenewCacheWithNamespaceFromArray()
134
+    {
135 135
     $cacheKey = 'expired_key';
136 136
     $namespace = 'expired_namespace';
137 137
     $cacheData = ['name' => 'Expired User', 'email' => '[email protected]'];
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     $this->cache->renewCache($cacheKey, 7200, $namespace);
146 146
     $this->assertTrue($this->cache->isSuccess());
147 147
     $this->assertNotEmpty($this->cache->getCache($cacheKey, $namespace));
148
-  }
148
+    }
149 149
 
150 150
     public function testClearCacheDataFromArray()
151 151
     {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $this->assertEquals("Cache flushed successfully", $this->cache->getMessage());
182 182
     }
183 183
 
184
-  public function test_remember_saves_and_recover_values() 
184
+    public function test_remember_saves_and_recover_values() 
185 185
     {
186 186
         $this->cache->flushCache();
187 187
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     }
217 217
 
218 218
 
219
-      public function test_get_and_forget()
219
+        public function test_get_and_forget()
220 220
     {
221 221
         $cacheKey = 'cache_key_test';
222 222
         $this->cache->putCache($cacheKey, 10);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         $this->assertNull($noCacheData);
238 238
     }
239 239
 
240
-      public function test_store_if_not_present_with_add_function()
240
+        public function test_store_if_not_present_with_add_function()
241 241
     {
242 242
         $existentKey = 'cache_key_test';
243 243
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 
262 262
     }
263 263
 
264
-      public function test_increment_function() {
264
+        public function test_increment_function() {
265 265
 
266 266
         $cacheKey = 'test_increment';
267 267
         $cacheData = 2025;
Please login to merge, or discard this patch.