Completed
Push — V3 ( 2749e1...545f19 )
by Georges
01:56
created
src/Command/PhpfastcacheGetCommand.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 namespace Phpfastcache\Bundle\Command;
19 19
 
20 20
 use Phpfastcache\Bundle\Service\Phpfastcache;
21
-use Phpfastcache\Exceptions\PhpfastcacheDriverCheckException;
22 21
 use Symfony\Component\Console\Command\Command;
23 22
 use Symfony\Component\Console\Input\InputArgument;
24 23
 use Symfony\Component\Console\Input\InputInterface;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,18 +53,18 @@
 block discarded – undo
53 53
     protected function configure()
54 54
     {
55 55
         $this
56
-          ->setName('phpfastcache:get')
57
-          ->setDescription('Get phpfastcache cache value')
58
-          ->addArgument(
56
+            ->setName('phpfastcache:get')
57
+            ->setDescription('Get phpfastcache cache value')
58
+            ->addArgument(
59 59
             'driver',
60 60
             InputArgument::REQUIRED,
61 61
             'Cache name to clear'
62
-          )
63
-          ->addArgument(
62
+            )
63
+            ->addArgument(
64 64
             'key',
65 65
             InputArgument::REQUIRED,
66 66
             'Cache key'
67
-          );
67
+            );
68 68
     }
69 69
 
70 70
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,23 +80,23 @@
 block discarded – undo
80 80
         $driver = $input->getArgument('driver');
81 81
         $cacheKey = $input->getArgument('key');
82 82
 
83
-        if (\array_key_exists($driver, $caches[ 'drivers' ])) {
83
+        if (\array_key_exists($driver, $caches['drivers'])) {
84 84
             $io->section($driver);
85 85
             $cacheItem = $this->phpfastcache->get($driver)->getItem($cacheKey);
86 86
 
87
-            if($cacheItem->isHit()){
87
+            if ($cacheItem->isHit()) {
88 88
                 $cacheItemValue = $cacheItem->get();
89
-                if(!\is_object($cacheItemValue)){
89
+                if (!\is_object($cacheItemValue)) {
90 90
                     ob_start();
91 91
                     var_dump($cacheItemValue);
92 92
                     $content = ob_get_contents();
93 93
                     ob_end_clean();
94 94
                     $io->write('<bg=green;fg=black>[HIT]</> ' . $content);
95
-                }else{
95
+                } else {
96 96
                     $io->write('<bg=green;fg=black>[HIT]</> (object) ' . \get_class($cacheItemValue));
97 97
                 }
98
-                $io->write('This item will expires in <fg=green>' . $cacheItem->getTtl() .'</> second(s)');
99
-            }else{
98
+                $io->write('This item will expires in <fg=green>' . $cacheItem->getTtl() . '</> second(s)');
99
+            } else {
100 100
                 $io->write('<bg=yellow;fg=red>[MISS]</> The cache item "' . $cacheKey . '" does not (yet) exists !');
101 101
             }
102 102
         } else {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,11 +92,11 @@
 block discarded – undo
92 92
                     $content = ob_get_contents();
93 93
                     ob_end_clean();
94 94
                     $io->write('<bg=green;fg=black>[HIT]</> ' . $content);
95
-                }else{
95
+                } else{
96 96
                     $io->write('<bg=green;fg=black>[HIT]</> (object) ' . \get_class($cacheItemValue));
97 97
                 }
98 98
                 $io->write('This item will expires in <fg=green>' . $cacheItem->getTtl() .'</> second(s)');
99
-            }else{
99
+            } else{
100 100
                 $io->write('<bg=yellow;fg=red>[MISS]</> The cache item "' . $cacheKey . '" does not (yet) exists !');
101 101
             }
102 102
         } else {
Please login to merge, or discard this patch.
src/Command/PhpfastcacheDelCommand.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -53,19 +53,19 @@
 block discarded – undo
53 53
     protected function configure()
54 54
     {
55 55
         $this
56
-          ->setName('phpfastcache:del')
57
-          ->setAliases([ 'phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove'])
58
-          ->setDescription('Delete phpfastcache cache value')
59
-          ->addArgument(
56
+            ->setName('phpfastcache:del')
57
+            ->setAliases([ 'phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove'])
58
+            ->setDescription('Delete phpfastcache cache value')
59
+            ->addArgument(
60 60
             'driver',
61 61
             InputArgument::REQUIRED,
62 62
             'Cache name to clear'
63
-          )
64
-          ->addArgument(
63
+            )
64
+            ->addArgument(
65 65
             'key',
66 66
             InputArgument::REQUIRED,
67 67
             'Cache key'
68
-          );
68
+            );
69 69
     }
70 70
 
71 71
     /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $this
56 56
           ->setName('phpfastcache:del')
57
-          ->setAliases([ 'phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove'])
57
+          ->setAliases(['phpfastcache:delete', 'phpfastcache:rem', 'phpfastcache:remove'])
58 58
           ->setDescription('Delete phpfastcache cache value')
59 59
           ->addArgument(
60 60
             'driver',
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
         $driver = $input->getArgument('driver');
82 82
         $cacheKey = $input->getArgument('key');
83 83
 
84
-        if (\array_key_exists($driver, $caches[ 'drivers' ])) {
84
+        if (\array_key_exists($driver, $caches['drivers'])) {
85 85
             $io->section($driver);
86 86
             $driverInstance = $this->phpfastcache->get($driver);
87 87
             $cacheItem = $driverInstance->getItem($cacheKey);
88 88
 
89
-            if(!$cacheItem->isHit()){
89
+            if (!$cacheItem->isHit()) {
90 90
                 $io->note(\sprintf('Cache item "%s" does not exists in the cache', $cacheKey));
91
-            }else{
91
+            } else {
92 92
                 $driverInstance->deleteItem($cacheItem->getKey());
93 93
                 $io->success(\sprintf('Cache item "%s" has been deleted from cache', $cacheKey));
94 94
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
 
89 89
             if(!$cacheItem->isHit()){
90 90
                 $io->note(\sprintf('Cache item "%s" does not exists in the cache', $cacheKey));
91
-            }else{
91
+            } else{
92 92
                 $driverInstance->deleteItem($cacheItem->getKey());
93 93
                 $io->success(\sprintf('Cache item "%s" has been deleted from cache', $cacheKey));
94 94
             }
Please login to merge, or discard this patch.
src/Command/PhpfastcacheSetCommand.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,28 +53,28 @@
 block discarded – undo
53 53
     protected function configure()
54 54
     {
55 55
         $this
56
-          ->setName('phpfastcache:set')
57
-          ->setDescription('Set phpfastcache cache value')
58
-          ->addArgument(
56
+            ->setName('phpfastcache:set')
57
+            ->setDescription('Set phpfastcache cache value')
58
+            ->addArgument(
59 59
             'driver',
60 60
             InputArgument::REQUIRED,
61 61
             'Cache name to clear'
62
-          )
63
-          ->addArgument(
62
+            )
63
+            ->addArgument(
64 64
             'key',
65 65
             InputArgument::REQUIRED,
66 66
             'Cache key'
67
-          )
68
-          ->addArgument(
67
+            )
68
+            ->addArgument(
69 69
             'value',
70 70
             InputArgument::REQUIRED,
71 71
             'Cache value'
72
-          )
73
-          ->addArgument(
72
+            )
73
+            ->addArgument(
74 74
             'ttl',
75 75
             InputArgument::OPTIONAL,
76 76
             'Cache ttl (in second)'
77
-          );
77
+            );
78 78
     }
79 79
 
80 80
     /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,16 +92,16 @@
 block discarded – undo
92 92
         $cacheValue = $input->getArgument('value');
93 93
         $cacheTtl = $input->getArgument('ttl');
94 94
 
95
-        if (\array_key_exists($driver, $caches[ 'drivers' ])) {
95
+        if (\array_key_exists($driver, $caches['drivers'])) {
96 96
             $io->section($driver);
97 97
             $driverInstance = $this->phpfastcache->get($driver);
98 98
             $cacheItem = $driverInstance->getItem($cacheKey);
99 99
             $cacheItem->set($cacheValue);
100 100
 
101
-            if($cacheTtl){
102
-                if(\is_numeric($cacheTtl)){
101
+            if ($cacheTtl) {
102
+                if (\is_numeric($cacheTtl)) {
103 103
                     $cacheItem->expiresAfter($cacheTtl);
104
-                }else{
104
+                } else {
105 105
                     $io->error(\sprintf('Invalid ttl value format "%s", must be a valid integer, aborting...', $cacheTtl));
106 106
                     return;
107 107
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@
 block discarded – undo
101 101
             if($cacheTtl){
102 102
                 if(\is_numeric($cacheTtl)){
103 103
                     $cacheItem->expiresAfter($cacheTtl);
104
-                }else{
104
+                } else{
105 105
                     $io->error(\sprintf('Invalid ttl value format "%s", must be a valid integer, aborting...', $cacheTtl));
106 106
                     return;
107 107
                 }
Please login to merge, or discard this patch.