Passed
Pull Request — main (#39)
by Sílvio
02:57
created
src/Support/TimeBuilder.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -13,91 +13,91 @@
 block discarded – undo
13 13
 class TimeBuilder
14 14
 {
15 15
 
16
-  /** @param string $unit */
17
-  private string $unit;
16
+    /** @param string $unit */
17
+    private string $unit;
18 18
 
19
-  /** @param int $value */
20
-  private int $value;
19
+    /** @param int $value */
20
+    private int $value;
21 21
 
22
-  /** @param Closure $callback */
23
-  private Closure $callback;
22
+    /** @param Closure $callback */
23
+    private Closure $callback;
24 24
 
25
-  /** @param FileOptionBuilder */
26
-  private $builder = null;
25
+    /** @param FileOptionBuilder */
26
+    private $builder = null;
27 27
 
28
-  public function __construct(Closure $callback, $builder)
29
-  {
28
+    public function __construct(Closure $callback, $builder)
29
+    {
30 30
     $this->callback = $callback;
31 31
     $this->builder = $builder;
32
-  }
33
-
34
-  /**
35
-  * @param int $value
36
-  * @return FileOptionBuilder|mixed
37
-  */
38
-  public function second(int $value) 
39
-  {
32
+    }
33
+
34
+    /**
35
+     * @param int $value
36
+     * @return FileOptionBuilder|mixed
37
+     */
38
+    public function second(int $value) 
39
+    {
40 40
     return $this->setTime($value, "seconds");
41
-  }
42
-
43
-  /**
44
-  * @param int $value
45
-  * @return FileOptionBuilder|mixed
46
-  */
47
-  public function minute(int $value) 
48
-  {
41
+    }
42
+
43
+    /**
44
+     * @param int $value
45
+     * @return FileOptionBuilder|mixed
46
+     */
47
+    public function minute(int $value) 
48
+    {
49 49
     return $this->setTime($value, "minutes");
50
-  }
51
-
52
-  /**
53
-  * @param int $value
54
-  * @return FileOptionBuilder|mixed
55
-  */
56
-  public function hour(int $value) 
57
-  {
50
+    }
51
+
52
+    /**
53
+     * @param int $value
54
+     * @return FileOptionBuilder|mixed
55
+     */
56
+    public function hour(int $value) 
57
+    {
58 58
     return $this->setTime($value, "hours");
59
-  }
60
-
61
-  /**
62
-  * @param int $value
63
-  * @return FileOptionBuilder|mixed
64
-  */
65
-  public function day(int $value) 
66
-  {
59
+    }
60
+
61
+    /**
62
+     * @param int $value
63
+     * @return FileOptionBuilder|mixed
64
+     */
65
+    public function day(int $value) 
66
+    {
67 67
     return $this->setTime($value, "days");
68
-  }
69
-
70
-  /**
71
-  * @param int $value
72
-  * @return FileOptionBuilder|mixed
73
-  */
74
-  public function week(int $value) 
75
-  {
68
+    }
69
+
70
+    /**
71
+     * @param int $value
72
+     * @return FileOptionBuilder|mixed
73
+     */
74
+    public function week(int $value) 
75
+    {
76 76
     return $this->setTime($value, "weeks");
77
-  }
78
-
79
-  /**
80
-  * @param int $value
81
-  * @return FileOptionBuilder|mixed
82
-  */
83
-  public function month(int $value) 
84
-  {
77
+    }
78
+
79
+    /**
80
+     * @param int $value
81
+     * @return FileOptionBuilder|mixed
82
+     */
83
+    public function month(int $value) 
84
+    {
85 85
     return $this->setTime($value, "months");
86
-  }
86
+    }
87 87
   
88 88
 
89
-  /**
90
-  * @param int $value
91
-  * @param string $unit
92
-  * @return FileOptionBuilder
93
-  */
94
-  private function setTime(int $value, string $unit) 
95
-  {
89
+    /**
90
+     * @param int $value
91
+     * @param string $unit
92
+     * @return FileOptionBuilder
93
+     */
94
+    private function setTime(int $value, string $unit) 
95
+    {
96 96
 
97 97
     $this->value = $value;
98 98
     $this->unit = $unit;
99
-   ($this->callback)("{$value} {$unit}");
99
+    ($this->callback)("{$value} {$unit}");
100 100
     return $this->builder;
101
-  }
101
+    }
102 102
 
103 103
 }
Please login to merge, or discard this patch.
tests/Unit/ArrayCacheStoreTest.php 1 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.
src/Core/ConnectionFactory.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
     /**
18
-      * @param array|null $database
19
-      * @return PDO|null
20
-    */
18
+     * @param array|null $database
19
+     * @return PDO|null
20
+     */
21 21
     public static function createConnection(?array $database = null)
22 22
     {
23 23
         $dbConf = $database ?? CACHEER_DATABASE_CONFIG[Connect::getConnection()];
Please login to merge, or discard this patch.
src/Core/Connect.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
     /**
21
-    * @param array|null $database
22
-    * @return PDO|null
23
-    */
21
+     * @param array|null $database
22
+     * @return PDO|null
23
+     */
24 24
     public static function getInstance(?array $database = null)
25 25
     {
26 26
         $pdo = ConnectionFactory::createConnection($database);
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
     }
32 32
 
33 33
     /**
34
-    * @param string $connection
35
-    * @return void
36
-    */
34
+     * @param string $connection
35
+     * @return void
36
+     */
37 37
     public static function setConnection(string $connection)
38 38
     {
39 39
         $drivers = ['mysql', 'sqlite', 'pgsql'];
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     /**
47
-    * @return string
48
-    */
47
+     * @return string
48
+     */
49 49
     public static function getConnection()
50 50
     {
51 51
         return self::$connection;
52 52
     }
53 53
 
54 54
     /**
55
-    * @return PDOException|null
56
-    */
55
+     * @return PDOException|null
56
+     */
57 57
     public static function getError()
58 58
     {
59 59
         return self::$error;
Please login to merge, or discard this patch.
src/Config/Option/Builder/OptionBuilder.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
  */
12 12
 class OptionBuilder
13 13
 {
14
-  /**
15
-  * @return FileOptionBuilder
16
-  */
17
-  public static function forFile() 
18
-  {
14
+    /**
15
+     * @return FileOptionBuilder
16
+     */
17
+    public static function forFile() 
18
+    {
19 19
     return new FileOptionBuilder();
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
src/Utils/CacheDriver.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
     }
66 66
 
67 67
     /**
68
-    * @return Cacheer
69
-    */
68
+     * @return Cacheer
69
+     */
70 70
     public function useArrayDriver()
71 71
     {
72 72
         $this->cacheer->cacheStore = new ArrayCacheStore($this->logPath);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     /**
77 77
      * @return Cacheer
78
-    */
78
+     */
79 79
     public function useDefaultDriver()
80 80
     {
81 81
         if (!isset($this->cacheer->options['cacheDir'])) {
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
     }
93 93
 
94 94
     /**
95
-    * @param mixed $dirName
96
-    * @return bool
97
-    */
95
+     * @param mixed $dirName
96
+     * @return bool
97
+     */
98 98
     private function isDir(mixed $dirName)
99 99
     {
100
-      if (is_dir($dirName)) {
101
-          return true;
102
-      }
103
-      return mkdir($dirName, 0755, true);
100
+        if (is_dir($dirName)) {
101
+            return true;
102
+        }
103
+        return mkdir($dirName, 0755, true);
104 104
     }
105 105
 }
Please login to merge, or discard this patch.
src/Helpers/CacheFileHelper.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 {
15 15
 
16 16
     /**
17
-    * @param string $expiration
18
-    * @return int
19
-    */
17
+     * @param string $expiration
18
+     * @return int
19
+     */
20 20
     public static function convertExpirationToSeconds(string $expiration)
21 21
     {
22 22
         $units = [
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     }
59 59
 
60 60
     /**
61
-    * @param string|int $ttl
62
-    * @param int $defaultTTL
63
-    * @return mixed
64
-    */
61
+     * @param string|int $ttl
62
+     * @param int $defaultTTL
63
+     * @return mixed
64
+     */
65 65
     public static function ttl($ttl = null, ?int $defaultTTL = null) {
66 66
         if ($ttl) {
67 67
             $ttl = is_string($ttl) ? self::convertExpirationToSeconds($ttl) : $ttl;
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
         return $ttl;
72 72
     }
73 73
 
74
-  /**
75
-  * @param mixed $currentCacheData
76
-  * @param mixed $cacheData
77
-  * @return array
78
-  */
79
-  public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
80
-  {
74
+    /**
75
+     * @param mixed $currentCacheData
76
+     * @param mixed $cacheData
77
+     * @return array
78
+     */
79
+    public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
80
+    {
81 81
     return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
82
-  }
82
+    }
83 83
 }
Please login to merge, or discard this patch.
src/Helpers/CacheRedisHelper.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
 class CacheRedisHelper
14 14
 {
15 15
 
16
-  /**
17
-  * @param mixed $data
18
-  * @param bool  $serialize
19
-  * @return mixed
20
-  */
21
-  public static function serialize(mixed $data, bool $serialize = true)
22
-  {
16
+    /**
17
+     * @param mixed $data
18
+     * @param bool  $serialize
19
+     * @return mixed
20
+     */
21
+    public static function serialize(mixed $data, bool $serialize = true)
22
+    {
23 23
     if($serialize) {
24
-      return serialize($data);
24
+        return serialize($data);
25 25
     }
26 26
 
27 27
     return unserialize($data);
28 28
 
29
-  }
29
+    }
30 30
 
31 31
     /**
32 32
      * @param array $item
@@ -49,15 +49,15 @@  discard block
 block discarded – undo
49 49
         return CacheerHelper::mergeCacheData($cacheData);
50 50
     }
51 51
 
52
-  /**
53
-    * @param mixed $currentCacheData
54
-    * @param mixed $cacheData
55
-    * @return array
56
-    */
57
-  public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
58
-  {
59
-      return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
60
-  }
52
+    /**
53
+     * @param mixed $currentCacheData
54
+     * @param mixed $cacheData
55
+     * @return array
56
+     */
57
+    public static function arrayIdentifier(mixed $currentCacheData, mixed $cacheData)
58
+    {
59
+        return CacheerHelper::arrayIdentifier($currentCacheData, $cacheData);
60
+    }
61 61
 
62 62
 }
63 63
 
Please login to merge, or discard this patch.
src/Exceptions/CacheRedisException.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
      */
59 59
     public function toJson(int $options = 0)
60 60
     {
61
-      return parent::toJson($options);
61
+        return parent::toJson($options);
62 62
     }
63 63
 }
64 64
 
Please login to merge, or discard this patch.