ImportDoctrineCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 6 1
1
<?php
2
3
namespace Doctrine\Bundle\DoctrineBundle\Command\Proxy;
4
5
use Doctrine\DBAL\Tools\Console\Command\ImportCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
@trigger_error(sprintf('The "%s" (doctrine:database:import) command is deprecated, use a database client instead.', ImportDoctrineCommand::class), E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
11
12
/**
13
 * Loads an SQL file and executes it.
14
 *
15
 * @deprecated Use a database client application instead.
16
 */
17
class ImportDoctrineCommand extends ImportCommand
0 ignored issues
show
Deprecated Code introduced by
The class Doctrine\DBAL\Tools\Console\Command\ImportCommand has been deprecated with message: Use a database client application instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
18
{
19
    /**
20
     * {@inheritDoc}
21
     */
22
    protected function configure()
23
    {
24
        parent::configure();
25
26
        $this
27
            ->setName('doctrine:database:import')
28
            ->addOption('connection', null, InputOption::VALUE_OPTIONAL, 'The connection to use for this command');
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        DoctrineCommandHelper::setApplicationConnection($this->getApplication(), $input->getOption('connection'));
0 ignored issues
show
Documentation introduced by
$this->getApplication() is of type null|object<Symfony\Comp...nt\Console\Application>, 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...
37
38
        return parent::execute($input, $output);
39
    }
40
}
41