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

StatRealpathGetCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 20%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 52
ccs 6
cts 30
cp 0.2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 18 1
A processFileList() 0 16 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