CacheWarmupCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 35
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 16 1
A execute() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
/*
5
 * Go! AOP framework
6
 *
7
 * @copyright Copyright 2013, Lisachenko Alexander <[email protected]>
8
 *
9
 * This source file is subject to the license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Go\Console\Command;
14
15
use Go\Instrument\ClassLoading\CacheWarmer;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
/**
20
 * Console command for warming the cache
21
 *
22
 * @codeCoverageIgnore
23
 */
24
class CacheWarmupCommand extends BaseAspectCommand
25
{
26
    /**
27
     * {@inheritDoc}
28
     */
29
    protected function configure(): void
30
    {
31
        parent::configure();
32
        $this
33
            ->setName('cache:warmup:aop')
34
            ->setDescription('Warm up the cache with woven aspects')
35
            ->setHelp(
36
                <<<EOT
37
Initializes the kernel and, if successful, warm up the cache for PHP
38
files under the application directory.
39
40
By default, the cache directory is taken from configured AspectKernel class.
41
EOT
42
            )
43
        ;
44
    }
45
46
    /**
47
     * {@inheritDoc}
48
     */
49
    protected function execute(InputInterface $input, OutputInterface $output): int
50
    {
51
        $this->loadAspectKernel($input, $output);
52
53
        $warmer = new CacheWarmer($this->aspectKernel, $output);
54
        $warmer->warmUp();
55
56
        return 0;
57
    }
58
}
59