MySQLProviderSetupCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 9
rs 9.6666
c 1
b 0
f 0
1
<?php
2
3
namespace NV\RequestLimitBundle\Command;
4
5
use Doctrine\DBAL\Connection;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Connection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class MySQLProviderSetupCommand extends ContainerAwareCommand
11
{
12
    protected function configure()
13
    {
14
        $this
15
            ->setName('nv:request-limit:mysql-init')
16
            ->setDescription('Creates a table in your project database to store keys')
17
            ->setHelp('This command initialize MySQL provider workflow')
18
        ;
19
    }
20
21
    protected function execute(InputInterface $input, OutputInterface $output)
22
    {
23
        /** @var Connection $connection */
24
        $connection = $this->getContainer()->get('doctrine.orm.default_entity_manager')->getConnection();
25
        $connection->exec('CREATE TABLE nv_request_limit_items (
26
            item_key VARCHAR(30) PRIMARY KEY,
27
            expires_at TIMESTAMP
28
            );');
29
        $connection->close();
30
    }
31
}
32