GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#158)
by Bernardo Vieira da
12:24
created

GearmanCacheClearCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 5
dl 0
loc 62
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setGearmanCacheWrapper() 0 6 1
A configure() 0 9 1
A execute() 0 15 2
1
<?php
2
3
/**
4
 * Gearman Bundle for Symfony2
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * Feel free to edit as you please, and have fun.
10
 *
11
 * @author Marc Morera <[email protected]>
12
 */
13
14
namespace Mmoreram\GearmanBundle\Command;
15
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
use Mmoreram\GearmanBundle\Command\Abstracts\AbstractGearmanCommand;
20
use Mmoreram\GearmanBundle\Service\GearmanCacheWrapper;
21
22
/**
23
 * Clears all cache data
24
 *
25
 * @since 2.3.1
26
 */
27
class GearmanCacheClearCommand extends AbstractGearmanCommand
28
{
29
    /**
30
     * @var GearmanCacheWrapper
31
     *
32
     * GearmanCacheWrapper
33
     */
34
    protected $gearmanCacheWrapper;
35
36
    /**
37
     * Set the GearmanCacheWrapper instance
38
     *
39
     * @param GearmanCacheWrapper $gearmanCacheWrapper GearmanCacheWrapper
40
     *
41
     * @return GearmanCacheWarmupCommand self Object
42
     */
43 2
    public function setGearmanCacheWrapper(GearmanCacheWrapper $gearmanCacheWrapper)
44
    {
45 2
        $this->gearmanCacheWrapper = $gearmanCacheWrapper;
46
47 2
        return $this;
48
    }
49
50
    /**
51
     * Console Command configuration
52
     */
53 2
    protected function configure()
54
    {
55
        $this
56 2
            ->setName('gearman:cache:clear')
57 2
            ->setAliases(array(
58 2
                'cache:gearman:clear'
59
            ))
60 2
            ->setDescription('Clears gearman cache data on current environment');
61 2
    }
62
63
    /**
64
     * Executes the current command.
65
     *
66
     * @param InputInterface  $input  An InputInterface instance
67
     * @param OutputInterface $output An OutputInterface instance
68
     *
69
     * @return integer 0 if everything went fine, or an error code
70
     *
71
     * @throws \LogicException When this abstract class is not implemented
72
     */
73 2
    protected function execute(InputInterface $input, OutputInterface $output)
74
    {
75
        if (
76 2
            !$input->getOption('quiet')
77
        ) {
78
            $kernelEnvironment = $this
79 1
                ->kernel
80 1
                ->getEnvironment();
81
82 1
            $output->writeln('Clearing the cache for the ' . $kernelEnvironment . ' environment');
83
        }
84
        $this
85 2
            ->gearmanCacheWrapper
86 2
            ->clear('');
87 2
    }
88
}
89