Passed
Push — master ( 56d9d0...3a16aa )
by Yuichi
04:59
created
src/Imports/AbstractImport.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
         return $this->config;
32 32
     }
33 33
 
34
-    public function setModels($models, $csv,$is_save=true)
34
+    public function setModels($models, $csv, $is_save = true)
35 35
     {
36 36
         foreach ($models as $table => $model) {
37
-            if (is_array($model) == false ) {
37
+            if (is_array($model) == false) {
38 38
                 continue;
39 39
             }
40 40
             $total = count($model);
41 41
             for ($i = 0; $i < $total; $i++) {
42 42
                 if (isset($this->config[$table][$i])) {
43
-                    $this->setModel($model[$i], $this->config[$table][$i], $csv, $table,$is_save);
43
+                    $this->setModel($model[$i], $this->config[$table][$i], $csv, $table, $is_save);
44 44
                 } else {
45 45
                     throw new \Exception('設定ファイルが正しくないか、構成が異なっています。table=' . $table);
46 46
                 }
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         return true;
50 50
     }
51 51
 
52
-    public function setModel($model, $config, $csv, $table,$is_save=true)
52
+    public function setModel($model, $config, $csv, $table, $is_save = true)
53 53
     {
54 54
         foreach ($config as $key => $rec) {
55 55
             $col = $this->getCsvCol($rec);
56
-            $func = ( isset($rec['func']) === true && $rec['func'] ) ? $rec['func'] : null; 
56
+            $func = (isset($rec['func']) === true && $rec['func']) ? $rec['func'] : null; 
57 57
             if (method_exists($this, $func) === true) {
58 58
                 $this->$func($model, $key, $csv, $col);
59
-            } elseif ( $func && method_exists($this, $func) === false) {
59
+            } elseif ($func && method_exists($this, $func) === false) {
60 60
                 throw new \Exception(get_class($this) . 'に関数=' . $func . 'が実装されていません。(table=' . $table . ')');
61 61
             } elseif (isset($rec['csv']) === true && isset($csv[$col]) === true) {
62 62
                 $model->$key = $csv[$col];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 $model->$key = null;
65 65
             }
66 66
         }
67
-        if ( $is_save ) {
67
+        if ($is_save) {
68 68
             $model->save();
69 69
         }
70 70
     }
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
         $col = isset($rec['csv']) ? $rec['csv'] : null;
75 75
         if (strpos($col, ",") !== false) {
76 76
             $col = explode(",", $col);
77
-        } elseif ( is_numeric($col) === true ) {
78
-            $col = ($col + 0 ) -1;
77
+        } elseif (is_numeric($col) === true) {
78
+            $col = ($col+0)-1;
79 79
         } 
80 80
         return $col;
81 81
     }
Please login to merge, or discard this patch.
src/TreeStructureTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     public function mergeCount($count_data)
51 51
     {
52 52
         $tree = isset($this->tree) ? $this->tree : [];
53
-        $this->addMergeCount($tree,$count_data);
53
+        $this->addMergeCount($tree, $count_data);
54 54
         /*
55 55
         foreach ($tree as &$rec) {
56 56
             foreach ($count_data as $count) {
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
         $this->tree = $tree;
70 70
     }
71 71
 
72
-    public function addMergeCount(&$tree,$count_data)
72
+    public function addMergeCount(&$tree, $count_data)
73 73
     {
74
-        foreach ( $tree as &$rec ) {
75
-            foreach ( $count_data as $count ) {
74
+        foreach ($tree as &$rec) {
75
+            foreach ($count_data as $count) {
76 76
                 if (isset($count->id) === false) {
77 77
                     throw new Exception('count data record object does not have property => "id".');
78 78
                 }
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
                 if ($rec->id == $count->id) {
83 83
                     $rec->count = $count->count;
84 84
                 }
85
-                if ( count($rec->children) ) {
86
-                    $this->addMergeCount($rec->children,$count_data);
85
+                if (count($rec->children)) {
86
+                    $this->addMergeCount($rec->children, $count_data);
87 87
                 }
88 88
             }
89 89
         }
Please login to merge, or discard this patch.