Passed
Push — master ( 7a28e2...eaf1d2 )
by Yuichi
02:24
created
src/Imports/AbstractImport.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
             $config = Yaml::parse($this->filesystem->get($config_file));
23 23
         }
24 24
         if (is_array($config)) {
25
-            $this->config = array_merge($this->config,$config);
25
+            $this->config = array_merge($this->config, $config);
26 26
         }
27 27
     }
28 28
     public function getConfig()
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
     }
32 32
     public function setModels($models, $csv)
33 33
     {
34
-        foreach ( $models as $table => $model ) {
35
-            if ( is_array($model) ) {
34
+        foreach ($models as $table => $model) {
35
+            if (is_array($model)) {
36 36
                 $total = count($model);
37
-                for($i=0;$i<$total;$i++) {
37
+                for ($i = 0; $i < $total; $i++) {
38 38
                     if (isset($this->config[$table][$i])) {
39
-                        $this->setModel($model[$i], $this->config[$table][$i],$csv,$table);
39
+                        $this->setModel($model[$i], $this->config[$table][$i], $csv, $table);
40 40
                     } else {
41 41
                         throw new \Exception('設定ファイルが正しくないか、構成が異なっています。table=' . $table);
42 42
                     }
@@ -48,21 +48,21 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function setModel($model, $config, $csv, $table)
50 50
     {
51
-        foreach ( $config as $key => $rec ) {
52
-            if ( isset($rec['func']) === true && $rec['func'] ) {
51
+        foreach ($config as $key => $rec) {
52
+            if (isset($rec['func']) === true && $rec['func']) {
53 53
                 $func = $rec['func'];
54 54
                 $col = isset($rec['csv']) ? $rec['csv'] : null;
55
-                if ( strpos($col,",") !== false ) {
56
-                    $col = explode(",",$col);
55
+                if (strpos($col, ",") !== false) {
56
+                    $col = explode(",", $col);
57 57
                 }
58
-                if ( method_exists($this,$func) === true ) {
59
-                    $this->$func($model,$key,$csv,$col);
58
+                if (method_exists($this, $func) === true) {
59
+                    $this->$func($model, $key, $csv, $col);
60 60
                 } else {
61 61
                     throw new \Exception(get_class($this) . 'に関数=' . $func . 'が実装されていません。');
62 62
                 }
63
-            } elseif ( isset($rec['csv']) && is_numeric($rec['csv']) === true && isset($csv[($rec['csv']+0)-1]) ) {
63
+            } elseif (isset($rec['csv']) && is_numeric($rec['csv']) === true && isset($csv[($rec['csv']+0)-1])) {
64 64
                 $model->$key = $csv[($rec['csv']+0)-1];
65
-            } elseif ( isset($rec['csv']) && is_numeric($rec['csv']) === false && isset($csv[$rec['csv']]) ) {
65
+            } elseif (isset($rec['csv']) && is_numeric($rec['csv']) === false && isset($csv[$rec['csv']])) {
66 66
                 $model->$key = $csv[$rec['csv']];
67 67
             } else {
68 68
                 $model->$key = null;
Please login to merge, or discard this patch.