Completed
Push — master ( 00f21d...76f138 )
by Boy
19:52 queued 16:05
created

MigrationsDiffDoctrineCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * Copyright 2015 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupGateway\U2fVerificationBundle\Console\Command;
20
21
use Surfnet\StepupGateway\U2fVerificationBundle\Exception\InvalidArgumentException;
22
use Symfony\Component\Console\Command\Command;
23
use Symfony\Component\Console\Input\ArrayInput;
24
use Symfony\Component\Console\Input\InputInterface;
25
use Symfony\Component\Console\Output\OutputInterface;
26
27
/**
28
 * @SuppressWarnings(PHPMD.UnusedLocalVariables)
29
 */
30
class MigrationsDiffDoctrineCommand extends Command
31
{
32
    /**
33
     * @var string|null
34
     */
35
    private $entityManagerName;
36
37
    /**
38
     * @param string|null $entityManagerName
39
     */
40 View Code Duplication
    public function __construct($entityManagerName = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        parent::__construct();
43
44
        if (!is_string($entityManagerName) && $entityManagerName !== null) {
45
            throw InvalidArgumentException::invalidType('string|null', 'entityManagerName', $entityManagerName);
46
        }
47
48
        $this->entityManagerName = $entityManagerName;
49
    }
50
51
    protected function configure()
52
    {
53
        $this->setName('u2f:migrations:diff');
54
        $this->setDescription('Performs a mapping/database diff using the correct entity manager');
55
    }
56
57
    public function execute(InputInterface $input, OutputInterface $output)
58
    {
59
        $output->writeln(['<info>Generating diff for U2F...</info>', '']);
60
61
        $parameters = ['doc:mig:diff'];
62
63
        if ($this->entityManagerName !== null) {
64
            $parameters['--em'] = $this->entityManagerName;
65
        }
66
67
        $this->getApplication()->doRun(new ArrayInput($parameters), $output);
68
    }
69
}
70