Completed
Pull Request — master (#38)
by Boris
04:23 queued 02:11
created

StatRealpathGetCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
ccs 0
cts 13
cp 0
rs 9.4285
nc 1
cc 1
eloc 12
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of CacheTool.
5
 *
6
 * (c) Samuel Gordalina <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CacheTool\Command;
13
14
use CacheTool\Util\Formatter;
15
use Symfony\Component\Console\Helper\Table;
16
use Symfony\Component\Console\Helper\TableSeparator;
17
use Symfony\Component\Console\Input\InputInterface;
18
use Symfony\Component\Console\Output\OutputInterface;
19
20
class StatRealpathGetCommand extends AbstractCommand
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 4
    protected function configure()
26
    {
27 4
        $this
28 4
            ->setName('stat:realpath_get')
29 4
            ->setDescription('Show summary information of realpath cache entries')
30 4
            ->setHelp('');
31 4
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $info = $this->getCacheTool()->stat_realpath_get();
39
40
        $table = new Table($output);
41
        $table
42
            ->setHeaders(array(
43
                'Path entry',
44
                'key',
45
                'is_dir',
46
                'realpath',
47
                'expires',
48
            ))
49
            ->setRows($this->processFilelist($info))
50
        ;
51
52
        $table->render($output);
0 ignored issues
show
Unused Code introduced by
The call to Table::render() has too many arguments starting with $output.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
53
    }
54
55
    protected function processFileList(array $cacheList)
56
    {
57
        $list = array();
58
59
        foreach ($cacheList as $path_entry => $item) {
60
            $list[] = array(
61
               $path_entry,
62
               $item['key'],
63
               $item['is_dir'],
64
               $item['realpath'],
65
               $item['expires'],
66
            );
67
        }
68
69
        return $list;
70
    }
71
}
72