Completed
Push — release-1.x ( 0efa6c...32f2bb )
by Boy
07:06 queued 03:32
created

MigrationsMigrateDoctrineCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
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
class MigrationsMigrateDoctrineCommand extends Command
28
{
29
    /**
30
     * @var string|null
31
     */
32
    private $entityManagerName;
33
34
    /**
35
     * @param string|null $entityManagerName
36
     */
37 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...
38
    {
39
        parent::__construct();
40
41
        if (!is_string($entityManagerName) && $entityManagerName !== null) {
42
            throw InvalidArgumentException::invalidType('string|null', 'entityManagerName', $entityManagerName);
43
        }
44
45
        $this->entityManagerName = $entityManagerName;
46
    }
47
48
    protected function configure()
49
    {
50
        $this->setName('u2f:migrations:migrate');
51
        $this->setDescription('Performs database migrations using the correct entity manager');
52
    }
53
54
    public function execute(InputInterface $input, OutputInterface $output)
55
    {
56
        $parameters = ['doc:mig:mig'];
57
58
        if ($this->entityManagerName !== null) {
59
            $parameters['--em'] = $this->entityManagerName;
60
        }
61
62
        $this->getApplication()->doRun(new ArrayInput($parameters), $output);
63
    }
64
}
65