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

GearmanCacheWarmupCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
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 66
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 16 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
 * Warms up all cache data
24
 *
25
 * @since 2.3.1
26
 */
27
class GearmanCacheWarmupCommand 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
     * Set the kernel environment
52
53
    /**
54
     * Console Command configuration
55
     */
56 2
    protected function configure()
57
    {
58
        $this
59 2
            ->setName('gearman:cache:warmup')
60 2
            ->setAliases(array(
61 2
                'cache:gearman:warmup'
62
            ))
63 2
            ->setDescription('Warms up gearman cache data');
64 2
    }
65
66
    /**
67
     * Executes the current command.
68
     *
69
     * @param InputInterface  $input  An InputInterface instance
70
     * @param OutputInterface $output An OutputInterface instance
71
     *
72
     * @return integer 0 if everything went fine, or an error code
73
     *
74
     * @throws \LogicException When this abstract class is not implemented
75
     */
76 2
    protected function execute(InputInterface $input, OutputInterface $output)
77
    {
78
        if (
79 2
            !$input->getOption('quiet')
80
        ) {
81
            $kernelEnvironment = $this
82 1
                ->kernel
83 1
                ->getEnvironment();
84
85 1
            $output->writeln('Warming the cache for the ' . $kernelEnvironment . ' environment');
86
        }
87
88
        $this
89 2
            ->gearmanCacheWrapper
90 2
            ->warmup('');
91 2
    }
92
}
93