Completed
Pull Request — master (#228)
by Guilherme
04:22
created

UpdateSentVerificationStatusCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 2
dl 0
loc 18
ccs 11
cts 11
cp 1
crap 1
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 1
    protected function configure()
23
    {
24
        $this
25 1
            ->setName('lc:phone-verification:update-sent-status')
26 1
            ->setDescription('Updates the status of SentVerification entities');
27 1
    }
28
29 1
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31 1
        $io = new SymfonyStyle($input, $output);
32
33 1
        $io->title('Update Verification Messages Status');
34
35
        /** @var SmsStatusService $updater */
36 1
        $updater = $this->getContainer()->get('phone_verification.sms_status');
37 1
        $updater->setSymfonyStyle($io);
38
39 1
        $io->section('Updating messages\' status');
40 1
        $updater->updateSentVerificationStatus(100);
41
42 1
        $io->section('Average delivery time');
43 1
        $avg = $updater->getAverageDeliveryTime(10);
44 1
        $io->text("The average delivery time is {$avg} seconds");
45
46 1
        $io->success('Finished updating statuses');
47 1
    }
48
}
49