Test Failed
Pull Request — master (#228)
by Guilherme
03:49
created

UpdateSentVerificationStatusCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\PhoneVerificationBundle\Command;
12
13
use LoginCidadao\PhoneVerificationBundle\Service\SmsStatusService;
14
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
use Symfony\Component\Console\Style\SymfonyStyle;
18
19
class UpdateSentVerificationStatusCommand extends ContainerAwareCommand
20
{
21
22
    protected function configure()
23
    {
24
        $this
25
            ->setName('lc:phone-verification:update-sent-status')
26
            ->setDescription('Updates the status of SentVerification entities');
27
    }
28
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        $io = new SymfonyStyle($input, $output);
32
33
        $io->title('Update Verification Messages Status');
34
35
        /** @var SmsStatusService $updater */
36
        $updater = $this->getContainer()->get('phone_verification.sms_status');
37
        $updater->setSymfonyStyle($io);
38
39
        $io->section('Updating messages\' status');
40
        $updater->updateSentVerificationStatus(100);
41
42
        $io->section('Average delivery time');
43
        $avg = $updater->getAverageDeliveryTime(10);
44
        $io->text("The average delivery time is {$avg} seconds");
45
46
        $io->success('Finished updating statuses');
47
    }
48
}
49