-
Notifications
You must be signed in to change notification settings - Fork 1
/
CommandConfigResolver.php
36 lines (31 loc) · 1008 Bytes
/
CommandConfigResolver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* This source file is available under :
* - GNU General Public License version 3 (GPLv3)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) sndsabin
*/
namespace SNDSABIN\ImportBundle\Traits;
trait CommandConfigResolver
{
/**
* @return array
*/
public function resolve(): array
{
$mapper = $this->config->get("{$this->class}.mapper");
$importer = $this->config->get("{$this->class}.importer") !== '' ?
$this->config->get("{$this->class}.importer") :
"SNDSABIN\ImportBundle\Importer\BaseImporter";
if ($this->file) {
$file = $this->file;
} else {
$file = $this->config->get("{$this->class}.file") !== '' ?
"{$this->config->get('base_directory')}/{$this->config->get("{$this->class}.file")}" :
'';
}
return [$file, $importer, $mapper];
}
}