Passed
Push — master ( 322909...0d49b4 )
by Yuichi
02:51 queued 17s
created
src/Valiable.php 1 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) ) {
56
-            foreach ( $data as $name => $rec ) {
57
-                foreach ( $rec as $key => $values ) {
58
-                    if ( isset($values['value'] ) ) {
59
-                        $this->set($name . '_' . $key,$values['value']);
55
+        if (is_array($data)) {
56
+            foreach ($data as $name => $rec) {
57
+                foreach ($rec as $key => $values) {
58
+                    if (isset($values['value'])) {
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.