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

CleanUpAccessTokensCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 21
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 7 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
    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