__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Migrations\Tools\Console;
6
7
use Doctrine\Migrations\Configuration\Configuration;
8
use Doctrine\Migrations\MigratorConfiguration;
9
use Symfony\Component\Console\Input\InputInterface;
10
11
class ConsoleInputMigratorConfigurationFactory implements MigratorConfigurationFactory
12
{
13
    /** @var Configuration */
14
    private $configuration;
15
16 33
    public function __construct(Configuration $configuration)
17
    {
18 33
        $this->configuration = $configuration;
19 33
    }
20
21 33
    public function getMigratorConfiguration(InputInterface $input) : MigratorConfiguration
22
    {
23 33
        $timeAllQueries = $input->hasOption('query-time') ? (bool) $input->getOption('query-time') : false;
24 33
        $dryRun         = $input->hasOption('dry-run') ? (bool) $input->getOption('dry-run') : false;
25 33
        $allOrNothing   = $input->hasOption('all-or-nothing') ? (bool) $input->getOption('all-or-nothing') : $this->configuration->isAllOrNothing();
26
27 33
        return (new MigratorConfiguration())
28 33
            ->setDryRun($dryRun)
29 33
            ->setTimeAllQueries($timeAllQueries)
30 33
            ->setAllOrNothing($allOrNothing);
31
    }
32
}
33