Completed
Push — master ( faed70...56c59d )
by Philip
13:07
created

CleanUpAccessTokensCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Dontdrinkandroot\RestBundle\Command;
4
5
use Dontdrinkandroot\RestBundle\Service\AccessTokenServiceInterface;
6
use Symfony\Component\Console\Command\Command;
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 Command
14
{
15
    protected static $defaultName = 'ddr:rest:access-token:cleanup';
16
17
    /**
18
     * @var AccessTokenServiceInterface
19
     */
20
    private $accessTokenService;
21
22
    /**
23
     * CleanUpAccessTokensCommand constructor.
24
     */
25 2
    public function __construct(AccessTokenServiceInterface $accessTokenService)
26
    {
27 2
        parent::__construct();
28 2
        $this->accessTokenService = $accessTokenService;
29 2
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 2
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36 2
        $numTokensRemoved = $this->accessTokenService->cleanUpExpiredTokens();
37 2
        $output->writeln($numTokensRemoved . ' tokens removed');
38 2
    }
39
}
40