Passed
Push — development ( af9588...0a99ba )
by Mirco
02:26
created

CreateWebCacheCommand::execute()   B

Complexity

Conditions 2
Paths 1

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 15
nc 1
nop 2
dl 0
loc 26
rs 8.8571
c 1
b 0
f 0
1
<?php
2
/***************************************************************************
3
 *  For license information see doc/license.txt
4
 *
5
 *  Unicode Reminder メモ
6
 ***************************************************************************/
7
8
namespace AppBundle\Command;
9
10
use Oc\Cache\WebCache;
11
use Oc\Session\SessionDataCookie;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class CreateWebCacheCommand extends AbstractCommand
16
{
17
    const COMMAND_NAME = 'cache:create-web-cache';
18
19
    /**
20
     * @return void
21
     * @throws \Symfony\Component\Console\Exception\InvalidArgumentException
22
     */
23
    protected function configure()
24
    {
25
        parent::configure();
26
27
        $this
28
            ->setName(self::COMMAND_NAME)
29
            ->setDescription('create legacy web caches');
30
    }
31
32
    /**
33
     * @param \Symfony\Component\Console\Input\InputInterface $input
34
     * @param \Symfony\Component\Console\Output\OutputInterface $output
35
     *
36
     * @return int|null
37
     */
38
    protected function execute(InputInterface $input, OutputInterface $output)
39
    {
40
        $output->writeln('not complete implemented yet');
41
        return self::CODE_ERROR;
42
        // TODO implement completely
43
        global $opt, $cookie;
0 ignored issues
show
Unused Code introduced by
// TODO implement completely global $opt, $cookie; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
44
45
        if (!isset($opt['rootpath'])) {
46
            $opt['rootpath'] = __DIR__ . '/../../../../htdocs/';
47
        }
48
49
        $cookie = new SessionDataCookie();
50
51
        require_once __DIR__ . '/../../../lib2/cli.inc.php';
52
53
        $webCache = new WebCache();
54
55
        $output->writeln('Create menu cache file');
56
        $webCache->createMenuCache();
57
58
        $output->writeln('Create label cache file');
59
        $webCache->createLabelCache();
60
61
        $output->writeln('Precompiling template files');
62
        $webCache->preCompileAllTemplates();
63
    }
64
}
65