Passed
Push — main ( 8d62a5...f85ac5 )
by Sílvio
03:16
created
src/Repositories/CacheDatabaseRepository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @param string|int $ttl
30 30
      * @return bool
31 31
      */
32
-    public function store(string $cacheKey, mixed $cacheData, string $namespace, string|int $ttl = 3600)
32
+    public function store(string $cacheKey, mixed $cacheData, string $namespace, string | int $ttl = 3600)
33 33
     {
34 34
         $expirationTime = date('Y-m-d H:i:s', time() + $ttl);
35 35
         $createdAt = date('Y-m-d H:i:s');
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     * @param string $namespace
111 111
     * @return bool
112 112
     */
113
-    public function renew(string $cacheKey, string|int $ttl, string $namespace = '')
113
+    public function renew(string $cacheKey, string | int $ttl, string $namespace = '')
114 114
     {
115 115
         $currentTime = date('Y-m-d H:i:s');
116 116
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
                 SET expirationTime = DATE_ADD(expirationTime, INTERVAL ? SECOND)
131 131
                 WHERE cacheKey = ? AND cacheNamespace = ? AND expirationTime > ?"
132 132
             );
133
-            $stmt->bindValue(1, (int) $ttl, PDO::PARAM_INT);
133
+            $stmt->bindValue(1, (int)$ttl, PDO::PARAM_INT);
134 134
             $stmt->bindValue(2, $cacheKey);
135 135
             $stmt->bindValue(3, $namespace);
136 136
             $stmt->bindValue(4, $currentTime);
Please login to merge, or discard this patch.
Examples/example08.php 1 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 1 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/Exceptions/CacheDatabaseException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
   */
18 18
   public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
19 19
   {
20
-    return new self(self::getBefore() . ": " .$message, $code, $previous, $details);
20
+    return new self(self::getBefore() . ": " . $message, $code, $previous, $details);
21 21
   }
22 22
 
23 23
 
Please login to merge, or discard this patch.
src/Exceptions/CacheFileException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
   */
18 18
   public static function create(string $message = "", int $code = 0, ?Exception $previous = null, array $details = [])
19 19
   {
20
-    return new self(self::getBefore() . ": " .$message, $code, $previous, $details);
20
+    return new self(self::getBefore() . ": " . $message, $code, $previous, $details);
21 21
   }
22 22
 
23 23
 
Please login to merge, or discard this patch.
src/CacheStore/FileCacheStore.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @param string|int $ttl
73 73
      * @return string|null
74 74
      */
75
-    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600)
75
+    public function getCache(string $cacheKey, string $namespace = '', string | int $ttl = 3600)
76 76
     {
77 77
        
78 78
         $ttl = CacheFileHelper::ttl($ttl, $this->defaultTTL);
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param string|int $ttl
98 98
      * @return void
99 99
      */
100
-    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string|int $ttl = 3600)
100
+    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', string | int $ttl = 3600)
101 101
     {
102 102
         $cacheFile = $this->buildCacheFilePath($cacheKey, $namespace);
103 103
         $data = $this->fileManager->serialize($cacheData);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
      * @param string $namespace
172 172
      * @return void
173 173
      */
174
-    public function renewCache(string $cacheKey, string|int $ttl, string $namespace = '')
174
+    public function renewCache(string $cacheKey, string | int $ttl, string $namespace = '')
175 175
     {
176 176
         $cacheData = $this->getCache($cacheKey, $namespace);
177 177
         if ($cacheData) {
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
     {
279 279
         $flushAfterSeconds = CacheFileHelper::convertExpirationToSeconds($flushAfter);
280 280
 
281
-        if(!$this->fileManager->fileExists($this->lastFlushTimeFile)) {
281
+        if (!$this->fileManager->fileExists($this->lastFlushTimeFile)) {
282 282
             $this->fileManager->writeFile($this->lastFlushTimeFile, time());
283 283
             return;
284 284
         }
285 285
 
286
-        $lastFlushTime = (int) $this->fileManager->readFile($this->lastFlushTimeFile);
286
+        $lastFlushTime = (int)$this->fileManager->readFile($this->lastFlushTimeFile);
287 287
 
288 288
         if ((time() - $lastFlushTime) >= $flushAfterSeconds) {
289 289
             $this->flushCache();
Please login to merge, or discard this patch.