GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b3d206...b445d1 )
by Robert
02:13
created

ReleaseLockCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Gruberro\MongoDbMigrations\Console\Command;
4
5
use Gruberro\MongoDbMigrations;
6
use Symfony\Component\Console;
7
8
class ReleaseLockCommand extends Console\Command\Command
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 2
    protected function configure()
14
    {
15 2
        $this
16 2
            ->setName('php-mongodb-migrations:release-lock')
17 2
            ->setDescription('Release current migration lock')
18 2
            ->addOption(
19 2
                'server',
20 2
                's',
21 2
                Console\Input\InputOption::VALUE_REQUIRED,
22 2
                'The connection string (e.g. mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db)',
23
                'mongodb://localhost:27017'
24 2
            )
25 2
            ->addArgument(
26 2
                'database',
27 2
                Console\Input\InputArgument::REQUIRED,
28
                'The database to connect to'
29 2
            )
30
        ;
31 2
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 2
    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
37
    {
38 2
        $client = new \MongoClient($input->getOption('server'));
39 2
        $db = $client->selectDB($input->getArgument('database'));
40 2
        $output->writeln("<info>✓ Successfully established database connection</info>", $output::VERBOSITY_VERBOSE);
41
42 2
        $databaseMigrationsLockCollection = $db->selectCollection('DATABASE_MIGRATIONS_LOCK');
43 2
        $databaseMigrationsLockCollection->update(['locked' => ['$exists' => true]], ['$set' => ['locked' => false]], ['upsert' => true]);
44 2
        $output->writeln("<info>✓ Successfully released migration lock</info>");
45 2
    }
46
}
47