1 | <?php |
||
7 | abstract class AbstractImport |
||
8 | { |
||
9 | protected $config; |
||
10 | private $filesystem; |
||
11 | |||
12 | 8 | public function __construct(Filesystem $filesystem = null) |
|
13 | { |
||
14 | 8 | $this->config = []; |
|
15 | 8 | $this->filesystem = $filesystem ? $filesystem : new Filesystem; |
|
16 | 8 | } |
|
17 | |||
18 | 5 | public function setConfig($config_file, $is_force = false) |
|
19 | { |
||
20 | 5 | $config = Yaml::parse($config_file); |
|
21 | 5 | if (is_array($config) === false || $is_force) { |
|
22 | 1 | $config = Yaml::parse($this->filesystem->get($config_file)); |
|
23 | 1 | } |
|
24 | 5 | if (is_array($config)) { |
|
25 | 5 | $this->config = array_merge($this->config, $config); |
|
26 | 5 | } |
|
27 | 5 | } |
|
28 | |||
29 | 1 | public function getConfig() |
|
33 | |||
34 | 5 | public function setModels($models, $csv) |
|
35 | { |
||
51 | |||
52 | 4 | public function setModel($model, $config, $csv, $table) |
|
69 | |||
70 | 4 | private function getCsvCol($rec) |
|
80 | |||
81 | } |
||
82 | |||
84 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.