Passed
Pull Request — main (#32)
by Sílvio
06:34 queued 03:50
created
src/Helpers/SqliteHelper.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     /**
39
-    * @param string $databaseDir
40
-    * @return void
41
-    */
39
+     * @param string $databaseDir
40
+     * @return void
41
+     */
42 42
     private static function createDatabaseDir(string $databaseDir)
43 43
     {
44 44
         if (!is_dir($databaseDir)) {
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
     }
48 48
 
49 49
     /**
50
-    * @param string $dbFile
51
-    * @return void
52
-    */
50
+     * @param string $dbFile
51
+     * @return void
52
+     */
53 53
     private static function createDatabaseFile(string $dbFile)
54 54
     {
55 55
         if (!file_exists($dbFile)) {
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
     }
59 59
 
60 60
     /**
61
-    * @param string $database
62
-    * @return string
63
-    */
61
+     * @param string $database
62
+     * @return string
63
+     */
64 64
     private static function checkExtension(string $database)
65 65
     {
66 66
         if (strpos($database, '.sqlite') === false) {
Please login to merge, or discard this patch.
src/Utils/CacheDataFormatter.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
     }
19 19
 
20 20
     /**
21
-    * @return string|false
22
-    */
21
+     * @return string|false
22
+     */
23 23
     public function toJson()
24 24
     {
25 25
         return json_encode(
@@ -31,24 +31,24 @@  discard block
 block discarded – undo
31 31
     }
32 32
 
33 33
     /**
34
-    * @return array
35
-    */
34
+     * @return array
35
+     */
36 36
     public function toArray()
37 37
     {
38 38
         return (array)$this->data;
39 39
     }
40 40
 
41 41
     /**
42
-    * @return string
43
-    */
42
+     * @return string
43
+     */
44 44
     public function toString()
45 45
     {
46 46
         return (string)$this->data;
47 47
     }
48 48
 
49 49
     /**
50
-    * @return object
51
-    */
50
+     * @return object
51
+     */
52 52
     public function toObject()
53 53
     {
54 54
         return (object)$this->data;
Please login to merge, or discard this patch.
src/Utils/CacheLogger.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,49 +23,49 @@  discard block
 block discarded – undo
23 23
     }
24 24
 
25 25
     /**
26
-    * @return void
27
-    */
26
+     * @return void
27
+     */
28 28
     public function info($message)
29 29
     {
30 30
         $this->log('INFO', $message);
31 31
     }
32 32
 
33 33
     /**
34
-    * @return void
35
-    */
34
+     * @return void
35
+     */
36 36
     public function warning($message)
37 37
     {
38 38
         $this->log('WARNING', $message);
39 39
     }
40 40
 
41 41
     /**
42
-    * @return void
43
-    */
42
+     * @return void
43
+     */
44 44
     public function error($message)
45 45
     {
46 46
         $this->log('ERROR', $message);
47 47
     }
48 48
 
49 49
     /**
50
-    * @return void
51
-    */
50
+     * @return void
51
+     */
52 52
     public function debug($message)
53 53
     {
54 54
         $this->log('DEBUG', $message);
55 55
     }
56 56
 
57 57
     /**
58
-    * @param mixed $level
59
-    * @return string|int|false
60
-    */
58
+     * @param mixed $level
59
+     * @return string|int|false
60
+     */
61 61
     private function shouldLog(mixed $level)
62 62
     {
63 63
         return array_search($level, $this->logLevels) >= array_search($this->logLevel, $this->logLevels);
64 64
     }
65 65
 
66 66
     /**
67
-    * @return void
68
-    */
67
+     * @return void
68
+     */
69 69
     private function rotateLog()
70 70
     {
71 71
         if (file_exists($this->logFile) && filesize($this->logFile) >= $this->maxFileSize) {
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
     }
76 76
 
77 77
     /**
78
-    * @param mixed $level
79
-    * @param string $message
80
-    * @return void
81
-    */
78
+     * @param mixed $level
79
+     * @param string $message
80
+     * @return void
81
+     */
82 82
     private function log($level, $message)
83 83
     {
84 84
         if (!$this->shouldLog($level)) {
Please login to merge, or discard this patch.
src/CacheStore/FileCacheStore.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@
 block discarded – undo
46 46
     private string $lastFlushTimeFile;
47 47
 
48 48
     /**
49
-    * @var CacheLogger
50
-    */
49
+     * @var CacheLogger
50
+     */
51 51
     private $logger = null;
52 52
 
53 53
     /**
54
-    * @var FileCacheManager
55
-    */
54
+     * @var FileCacheManager
55
+     */
56 56
     private FileCacheManager $fileManager;
57 57
 
58 58
     public function __construct(array $options = [])
Please login to merge, or discard this patch.
src/Repositories/CacheDatabaseRepository.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
     /**
51
-    * @param string $cacheKey
52
-    * @param string $namespace
53
-    * @return mixed
54
-    */
51
+     * @param string $cacheKey
52
+     * @param string $namespace
53
+     * @return mixed
54
+     */
55 55
     public function retrieve(string $cacheKey, string $namespace = '')
56 56
     {
57 57
         $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME);
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     /**
108
-    * @param string $cacheKey
109
-    * @param string|int $ttl
110
-    * @param string $namespace
111
-    * @return bool
112
-    */
108
+     * @param string $cacheKey
109
+     * @param string|int $ttl
110
+     * @param string $namespace
111
+     * @return bool
112
+     */
113 113
     public function renew(string $cacheKey, string|int $ttl, string $namespace = '')
114 114
     {
115 115
         $currentTime = date('Y-m-d H:i:s');
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
     }
164 164
 
165 165
     /**
166
-    * @param string $driver
167
-    * @return string
168
-    */
166
+     * @param string $driver
167
+     * @return string
168
+     */
169 169
     private function getCurrentDateTime(string $driver)
170 170
     {
171 171
         return ($driver === 'sqlite') ? "DATETIME('now', 'localtime')" : "NOW()";
Please login to merge, or discard this patch.
Examples/example08.php 1 patch
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.
Examples/example07.php 1 patch
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.
src/Helpers/EnvHelper.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
     }
35 35
 
36 36
     /**
37
-    * @return void
38
-    */
37
+     * @return void
38
+     */
39 39
     public static function copyEnv()
40 40
     {
41 41
         $rootDir = self::getRootPath();
Please login to merge, or discard this patch.
tests/Feature/OptionBuildTest.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
 class OptionBuildTest extends TestCase
8 8
 {
9 9
 
10
-  private $cache;
11
-  private $cacheDir;
10
+    private $cache;
11
+    private $cacheDir;
12 12
 
13
-  protected function setUp(): void
14
-  {
13
+    protected function setUp(): void
14
+    {
15 15
     $this->cacheDir = __DIR__ . '/cache';
16 16
     if (!file_exists($this->cacheDir) || !is_dir($this->cacheDir)) {
17
-      mkdir($this->cacheDir, 0755, true);
17
+        mkdir($this->cacheDir, 0755, true);
18 18
     }
19 19
 
20 20
     $this->cache = new Cacheer();
21
-  }
21
+    }
22 22
 
23
-  protected function tearDown(): void
24
-  {
23
+    protected function tearDown(): void
24
+    {
25 25
     $this->cache->flushCache();
26
-  }
26
+    }
27 27
 
28
-  public function test_it_can_set_cache_diretory()
29
-  {
28
+    public function test_it_can_set_cache_diretory()
29
+    {
30 30
     $cacheDir = __DIR__ . "/cache";
31 31
 
32 32
     $options = OptionBuilder::forFile()
@@ -35,23 +35,23 @@  discard block
 block discarded – undo
35 35
 
36 36
     $this->assertArrayHasKey('cacheDir', $options);
37 37
     $this->assertEquals($cacheDir, $options['cacheDir']);
38
-  }
38
+    }
39 39
 
40 40
 
41
-  public function test_it_can_set_expiration_time()
41
+    public function test_it_can_set_expiration_time()
42 42
     {
43 43
 
44
-      $options = OptionBuilder::forFile()
45
-      ->expirationTime('2 hours')
46
-      ->build();
44
+        $options = OptionBuilder::forFile()
45
+        ->expirationTime('2 hours')
46
+        ->build();
47 47
       
48
-      $this->assertArrayHasKey('expirationTime', $options);
49
-      $this->assertEquals('2 hours', $options['expirationTime']);
48
+        $this->assertArrayHasKey('expirationTime', $options);
49
+        $this->assertEquals('2 hours', $options['expirationTime']);
50 50
     }
51 51
 
52 52
     public function test_it_can_set_flush_after()
53 53
     {
54
-      $options = OptionBuilder::forFile()
54
+        $options = OptionBuilder::forFile()
55 55
         ->flushAfter('11 seconds')
56 56
         ->build();
57 57
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function test_it_can_set_multiple_options_together()
63 63
     {
64
-      $cacheDir = __DIR__ . "/cache";
64
+        $cacheDir = __DIR__ . "/cache";
65 65
 
66
-      $options = OptionBuilder::forFile()
66
+        $options = OptionBuilder::forFile()
67 67
             ->dir($cacheDir)
68 68
             ->expirationTime('1 day')
69 69
             ->flushAfter('30 minutes')
@@ -76,41 +76,41 @@  discard block
 block discarded – undo
76 76
         ], $options);
77 77
     }
78 78
 
79
-  public function test_it_allows_setting_expiration_time_with_timebuilder()
79
+    public function test_it_allows_setting_expiration_time_with_timebuilder()
80 80
     {
81
-      $options = OptionBuilder::forFile()->expirationTime()->week(1)->build();
82
-      $this->assertArrayHasKey('expirationTime', $options);
83
-      $this->assertEquals('1 weeks', $options['expirationTime']);
81
+        $options = OptionBuilder::forFile()->expirationTime()->week(1)->build();
82
+        $this->assertArrayHasKey('expirationTime', $options);
83
+        $this->assertEquals('1 weeks', $options['expirationTime']);
84 84
     }
85 85
 
86
-  public function test_it_allows_setting_flush_after_with_timebuilder()
87
-  {
86
+    public function test_it_allows_setting_flush_after_with_timebuilder()
87
+    {
88 88
     $options = OptionBuilder::forFile()->flushAfter()->second(10)->build();
89 89
     $this->assertArrayHasKey('flushAfter', $options);
90 90
     $this->assertEquals('10 seconds', $options['flushAfter']);
91
-  }
91
+    }
92 92
 
93
-  public function test_it_can_set_multiple_options_together_with_timebuilder()
94
-  {
93
+    public function test_it_can_set_multiple_options_together_with_timebuilder()
94
+    {
95 95
     $cacheDir = __DIR__ . "/cache";
96 96
     $options = OptionBuilder::forFile()
97
-          ->dir($cacheDir)
98
-          ->expirationTime()->week(1)
99
-          ->flushAfter()->minute(10)
100
-          ->build();
97
+            ->dir($cacheDir)
98
+            ->expirationTime()->week(1)
99
+            ->flushAfter()->minute(10)
100
+            ->build();
101 101
 
102 102
     $this->assertEquals([
103 103
             'cacheDir' => $cacheDir,
104 104
             'expirationTime' => '1 weeks',
105 105
             'flushAfter' => '10 minutes',
106 106
         ], $options);
107
-  }
107
+    }
108 108
 
109
-  public function test_it_returns_empty_array_when_no_options_are_set()
110
-  {
109
+    public function test_it_returns_empty_array_when_no_options_are_set()
110
+    {
111 111
     $options = OptionBuilder::forFile()->build();
112 112
     $this->assertIsArray($options);
113 113
     $this->assertEmpty($options);
114
-  }
114
+    }
115 115
 
116 116
 }
Please login to merge, or discard this patch.