| @@ -31,16 +31,16 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | } |