Completed
Push — master ( beec4b...b0a6d2 )
by Philip
08:54
created

CleanUpAccessTokensCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
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 2
    protected function configure()
19
    {
20 2
        $this->setName('ddr:rest:access-token:cleanup');
21 2
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 2
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        /** @var AccessTokenServiceInterface $accessTokenService */
29 2
        $accessTokenService = $this->getContainer()->get('ddr_rest.service.access_token');
30 2
        $numTokensRemoved = $accessTokenService->cleanUpExpiredTokens();
31 2
        $output->writeln($numTokensRemoved . ' tokens removed');
32 2
    }
33
}
34