Completed
Push — master ( abbc89...6b01a6 )
by Peter
03:39
created

ResetCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 3
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 7 1
A execute() 0 5 1
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2014, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace AnimeDb\Bundle\CacheTimeKeeperBundle\Command;
11
12
use AnimeDb\Bundle\CacheTimeKeeperBundle\Service\Keeper;
13
use Symfony\Component\Console\Command\Command;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
class ResetCommand extends Command
18
{
19
    /**
20
     * @var Keeper
21
     */
22
    protected $keeper;
23
24
    /**
25
     * @param Keeper $keeper
26
     */
27 2
    public function __construct(Keeper $keeper)
28
    {
29 2
        $this->keeper = $keeper;
30 2
        parent::__construct();
31 2
    }
32
33 2
    protected function configure()
34
    {
35 2
        $this
36 2
            ->setName('cache:reset-cache-time-keeper')
37 2
            ->setDescription('Reset last update date of the project')
38 2
            ->setHelp('Command only reset date of update. Not remove data from the storage.');
39 2
    }
40
41
    /**
42
     * @param InputInterface $input
43
     * @param OutputInterface $output
44
     *
45
     * @return integer|null
46
     */
47 1
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49 1
        $this->keeper->set(Keeper::LAST_UPDATE_KEY, new \DateTime());
50 1
        $output->writeln('Reset last update date of the project is complete.');
51 1
    }
52
}
53