Completed
Push — develop ( 67e161...8b0772 )
by Paul
05:50
created

DefaultConsoleConfigFactory::invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PhpUnitGen\Configuration;
4
5
/**
6
 * Class DefaultConsoleConfigFactory.
7
 *
8
 * @author     Paul Thébaud <[email protected]>.
9
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
10
 * @license    https://opensource.org/licenses/MIT The MIT license.
11
 * @link       https://github.com/paul-thebaud/phpunit-generator
12
 * @since      Class available since Release 2.0.0.
13
 */
14
class DefaultConsoleConfigFactory
15
{
16
    /**
17
     * Build a console configuration from a configuration file.
18
     *
19
     * @param string $sourceDirectory The source directory.
20
     * @param string $targetDirectory The target directory.
21
     *
22
     * @return ConsoleConfigInterface The created configuration.
23
     */
24
    public function invoke(string $sourceDirectory, string $targetDirectory): ConsoleConfigInterface
25
    {
26
        $configArray         = require __DIR__ . '/../../config/default.phpunitgen.config.php';
27
        $configArray['dirs'] = [
28
            $sourceDirectory => $targetDirectory
29
        ];
30
31
        return new ConsoleConfig($configArray);
32
    }
33
}
34