|
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
|
|
|
|