Completed
Pull Request — master (#546)
by Matthias
12:46
created

ImportDoctrineCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 8
loc 8
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Doctrine Bundle
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
11
12
use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
13
use Symfony\Component\Console\Input\InputOption;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
/**
18
 * Loads an SQL file and executes it.
19
 *
20
 * @author Matthias Pigulla <[email protected]>
21
 * @author Sebastian Landwehr <[email protected]>
22
 */
23 View Code Duplication
class ImportDoctrineCommand extends ImportCommand
0 ignored issues
show
Duplication introduced by
This class 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...
24
{
25
    /**
26
     * {@inheritDoc}
27
     */
28
    protected function configure()
29
    {
30
        parent::configure();
31
32
        $this
33
            ->setName('doctrine:database:import')
34
            ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    protected function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
0 ignored issues
show
Documentation introduced by
$this->getApplication() is of type object<Symfony\Component...nsole\Application>|null, but the function expects a object<Symfony\Bundle\Fr...le\Console\Application>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
43
44
        return parent::execute($input, $output);
45
    }
46
}
47