Completed
Push — master ( 77d201...cbf774 )
by Tim
05:07
created

MagentoConfigurationLoader::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 19
rs 9.4285
c 1
b 0
f 0
ccs 0
cts 17
cp 0
cc 1
eloc 15
nc 1
nop 7
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Model\MagentoConfigurationLoader
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-cli-magento
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Model;
22
23
use Symfony\Component\Console\Input\InputInterface;
24
use Magento\Framework\App\Filesystem\DirectoryList;
25
26
/**
27
 * The configuration factory implementation.
28
 *
29
 * @author    Tim Wagner <[email protected]>
30
 * @copyright 2016 TechDivision GmbH <[email protected]>
31
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
32
 * @link      https://github.com/techdivision/import-cli-magento
33
 * @link      http://www.techdivision.com
34
 */
35
class MagentoConfigurationLoader extends Configuration
36
{
37
38
    /**
39
     * The instance with the directory list.
40
     *
41
     * @var \Magento\Framework\Filesystem\DirectoryList
42
     */
43
    protected $directoryList;
44
45
    /**
46
     * Initializes the configuration loader.
47
     *
48
     * @param \Magento\Framework\Filesystem\DirectoryList                     $directoryList                The directory list
49
     * @param \Symfony\Component\Console\Input\InputInterface                 $input                        The input instance
50
     * @param \Symfony\Component\DependencyInjection\ContainerInterface       $container                    The container instance
51
     * @param \TechDivision\Import\Cli\LibraryLoader                          $libraryLoader                The configuration loader instance
52
     * @param \TechDivision\Import\ConfigurationFactoryInterface              $configurationFactory         The configuration factory instance
53
     * @param \TechDivision\Import\Utils\CommandNames                         $commandNames                 The available command names
54
     * @param \TechDivision\Import\Utils\Mappings\CommandNameToEntityTypeCode $commandNameToEntityTypeCodes The mapping of the command names to the entity type codes
55
     */
56
    public function __construct(
57
        DirectoryList $directoryList,
58
        InputInterface $input,
59
        ContainerInterface $container,
60
        LibraryLoader $libraryLoader,
61
        ConfigurationFactoryInterface $configurationFactory,
62
        CommandNames $commandNames,
63
        CommandNameToEntityTypeCode $commandNameToEntityTypeCodes
64
    ) {
65
66
        // set the passed instances
67
        $this->directoryList = $directoryList;
0 ignored issues
show
Documentation Bug introduced by
It seems like $directoryList of type object<Magento\Framework...lesystem\DirectoryList> is incompatible with the declared type object<Magento\Framework...lesystem\DirectoryList> of property $directoryList.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
68
        $this->input = $input;
69
        $this->container = $container;
70
        $this->libraryLoader = $libraryLoader;
71
        $this->configurationFactory = $configurationFactory;
72
        $this->commandNames = $commandNames;
73
        $this->commandNameToEntityTypeCode = $commandNameToEntityTypeCodes;
74
    }
75
76
    /**
77
     * Return's the vendor directory used to load the default configuration files from.
78
     *
79
     * @return string The vendor directory
80
     */
81
    public function getVendorDir()
82
    {
83
        return sprintf('%s/vendor', $this->directoryList->getPath('base'));
84
    }
85
}
86