Completed
Push — V3 ( 7804e3...ad2c3a )
by Georges
01:47
created
src/Command/PhpfastcacheSetCommand.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         $cacheTtl = $input->getArgument('ttl');
103 103
         $autoTypeCast = (bool) $input->getOption('auto-type-cast');
104 104
 
105
-        if (\array_key_exists($driver, $caches[ 'drivers' ])) {
105
+        if (\array_key_exists($driver, $caches['drivers'])) {
106 106
             $io->section($driver);
107 107
             $driverInstance = $this->phpfastcache->get($driver);
108 108
             $cacheItem = $driverInstance->getItem($cacheKey);
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 
111 111
             $cacheItem->set($autoTypeCast ? $castedCacheValue : $cacheValue);
112 112
 
113
-            if($cacheTtl){
114
-                if(\is_numeric($cacheTtl)){
113
+            if ($cacheTtl) {
114
+                if (\is_numeric($cacheTtl)) {
115 115
                     $cacheItem->expiresAfter($cacheTtl);
116
-                }else{
116
+                } else {
117 117
                     $io->error(\sprintf('Invalid ttl value format "%s", must be a valid integer, aborting...', $cacheTtl));
118 118
                     return;
119 119
                 }
120 120
             }
121 121
 
122
-            if(!$autoTypeCast || $castedCacheValue === $cacheValue) {
122
+            if (!$autoTypeCast || $castedCacheValue === $cacheValue) {
123 123
                 $io->success(\sprintf(
124 124
                   'Cache item "%s" set to "%s" for %d seconds',
125 125
                   $cacheKey,
@@ -148,24 +148,24 @@  discard block
 block discarded – undo
148 148
      */
149 149
     protected function autoTypeCast($string)
150 150
     {
151
-        if(\in_array(\strtolower($string), ['true', 'false'], true)){
151
+        if (\in_array(\strtolower($string), ['true', 'false'], true)) {
152 152
             return $string === 'true';
153 153
         }
154 154
 
155
-        if(\strtolower($string) === 'null'){
155
+        if (\strtolower($string) === 'null') {
156 156
             return null;
157 157
         }
158 158
 
159
-        if(\is_numeric($string))
159
+        if (\is_numeric($string))
160 160
         {
161
-            if(\strpos($string, '.') !== false){
161
+            if (\strpos($string, '.') !== false) {
162 162
                 return (float) $string;
163 163
             }
164 164
             return (int) $string;
165 165
         }
166 166
 
167 167
         $jsonArray = json_decode($string, true);
168
-        if(json_last_error() === JSON_ERROR_NONE){
168
+        if (json_last_error() === JSON_ERROR_NONE) {
169 169
             return (array) $jsonArray;
170 170
         }
171 171
 
Please login to merge, or discard this patch.