Passed
Push — master ( ccc743...3018e9 )
by Yuichi
02:23
created
src/Console/ValiableListCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
         $names = $this->valiable->getNames();
24 24
         $tmp = [];
25 25
         $len = 0;
26
-        foreach ( $names as $name ) {
26
+        foreach ($names as $name) {
27 27
             $len = strlen($name) > $len ? strlen($name) : $len;
28 28
             $tmp[] = [
29 29
                 'name' => $name,
30 30
                 'items' => serialize($this->valiable->get($name)),
31 31
             ];
32 32
         }
33
-        $headers = ['name','items'];
34
-        $this->table($headers,$tmp);
33
+        $headers = ['name', 'items'];
34
+        $this->table($headers, $tmp);
35 35
     }
36 36
 }
37 37
 
Please login to merge, or discard this patch.
src/Console/ValiableImportCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     protected $valiable;
14 14
     protected $filesystem;
15 15
 
16
-    public function __construct(Valiable $valiable,Filesystem $filesystem)
16
+    public function __construct(Valiable $valiable, Filesystem $filesystem)
17 17
     {
18 18
         $this->valiable = $valiable;
19 19
         $this->filesystem = $filesystem;
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
         $path = storage_path('app/sonar_valiables');
26 26
         $files = $this->filesystem->allFiles($path);
27 27
 
28
-        if ( is_array($files) && count($files) > 0 ) {
29
-            foreach ( $this->filesystem->allFiles($path) as $rec ) {
30
-                if ( preg_match("/\.yml$/",$rec->getPathname()) ) {
28
+        if (is_array($files) && count($files) > 0) {
29
+            foreach ($this->filesystem->allFiles($path) as $rec) {
30
+                if (preg_match("/\.yml$/", $rec->getPathname())) {
31 31
                     $this->valiable->importYaml($this->filesystem->get($rec->getPathname()));
32 32
                 }
33 33
             }
Please login to merge, or discard this patch.
src/Valiable.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@
 block discarded – undo
25 25
             throw new \Exception('value is null');
26 26
         }
27 27
         $data = $this->cache->get($this->prefix . $name);
28
-        if ( ! $data ) return null;
28
+        if ( ! $data ) {
29
+            return null;
30
+        }
29 31
 
30 32
         $data = $this->decode($data);
31 33
         if ( isset($data[$key]) === false  ) {
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
         return $data ? $this->decode($data) : null;
22 22
     }
23
-    public function getValue($name,$key)
23
+    public function getValue($name, $key)
24 24
     {
25
-        if ( is_null($key) ) {
25
+        if (is_null($key)) {
26 26
             throw new \Exception('value is null');
27 27
         }
28 28
         $data = $this->cache->get($this->prefix . $name);
29
-        if ( ! $data ) return null;
29
+        if ( ! $data) return null;
30 30
 
31 31
         $data = $this->decode($data);
32
-        if ( isset($data[$key]) === false  ) {
32
+        if (isset($data[$key]) === false) {
33 33
             throw new \Exception('value is not found. key=' . $key);
34 34
         }
35 35
         return $data[$key];
@@ -37,26 +37,26 @@  discard block
 block discarded – undo
37 37
     public function getNames()
38 38
     {
39 39
         $names = $this->cache->get($this->name_list);
40
-        if ( $names ) {
40
+        if ($names) {
41 41
             $names = $this->decode($names);
42 42
         } else {
43 43
             $names = [];
44 44
         }
45 45
         return $names;
46 46
     }
47
-    public function set($name,$data)
47
+    public function set($name, $data)
48 48
     {
49
-        $this->cache->forever($this->prefix . $name,$this->encode($data));
49
+        $this->cache->forever($this->prefix . $name, $this->encode($data));
50 50
         $this->addNames($name);
51 51
     }
52 52
     public function importYaml($yaml_data)
53 53
     {
54 54
         $data = Yaml::parse($yaml_data);
55
-        if ( is_array($data) === true) {
56
-            foreach ( $data as $name => $rec ) {
57
-                foreach ( $rec as $key => $values ) {
58
-                    if ( isset($values['value']) === true) {
59
-                        $this->set($name . '_' . $key,$values['value']);
55
+        if (is_array($data) === true) {
56
+            foreach ($data as $name => $rec) {
57
+                foreach ($rec as $key => $values) {
58
+                    if (isset($values['value']) === true) {
59
+                        $this->set($name . '_' . $key, $values['value']);
60 60
                     } else {
61 61
                         throw new \Exception('valueが見つかりません。key=' . $key);
62 62
                     }
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
     public function clear()
68 68
     {
69 69
         $names = $this->getNames();
70
-        if ( count($names) > 0 ) {
71
-            foreach ( $names as $name ) {
70
+        if (count($names) > 0) {
71
+            foreach ($names as $name) {
72 72
                 $this->cache->forget($this->prefix . $name);
73 73
             }
74 74
         }
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     protected function addNames($name)
78 78
     {
79 79
         $names = $this->getNames();
80
-        if ( in_array($name,$names) === false ) {
80
+        if (in_array($name, $names) === false) {
81 81
             $names[] = $name;
82 82
         }
83
-        $this->cache->forever($this->name_list,$this->encode($names));
83
+        $this->cache->forever($this->name_list, $this->encode($names));
84 84
     }
85 85
     protected function encode($data)
86 86
     {
Please login to merge, or discard this patch.