Completed
Push — master ( 2afc29...29656f )
by Philip
06:07
created

CleanUpAccessTokensCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Dontdrinkandroot\RestBundle\Command;
4
5
use Dontdrinkandroot\RestBundle\Service\AccessTokenServiceInterface;
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * @author Philip Washington Sorst <[email protected]>
12
 */
13
class CleanUpAccessTokensCommand extends ContainerAwareCommand
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    protected function configure()
19
    {
20
        $this->setName('ddr:rest:access-token:cleanup');
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        /** @var AccessTokenServiceInterface $accessTokenService */
29
        $accessTokenService = $this->getContainer()->get('ddr.rest.service.access_token');
30
        $numTokensRemoved = $accessTokenService->cleanUpExpiredTokens();
31
        $output->writeln($numTokensRemoved . ' tokens removed');
32
    }
33
}
34