• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gordalina / cachetool / 21418036912

27 Jan 2026 11:16PM UTC coverage: 91.631% (+1.2%) from 90.476%
21418036912

Pull #263

github

web-flow
Merge 519d4b6a4 into 732a831d5
Pull Request #263: Bump phpunit/phpunit from 9.5.25 to 9.6.33

1062 of 1159 relevant lines covered (91.63%)

124.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.76
/src/Command/ApcuCacheInfoKeysCommand.php
1
<?php
2

3
/*
4
 * This file is part of CacheTool.
5
 *
6
 * (c) Samuel Gordalina <samuel.gordalina@gmail.com>
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\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18

19
class ApcuCacheInfoKeysCommand extends ApcuCacheInfoCommand
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    protected function configure()
25
    {
26
        $this
400✔
27
            ->setName('apcu:cache:info:keys')
400✔
28
            ->setDescription('Shows APCu keys cache information')
400✔
29
            ->setHelp('');
400✔
30
    }
31

32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output): int
36
    {
37
        $this->ensureExtensionLoaded('apcu');
10✔
38

39
        $info = $this->getCacheTool()->apcu_cache_info(false);
10✔
40
        $this->normalize($info);
10✔
41

42
        if (empty($info)) {
10✔
43
            throw new \RuntimeException("Could not fetch info from APCu");
×
44
        }
45

46
        $header = [
10✔
47
            'Hits',
10✔
48
            'Accessed',
10✔
49
            'Deleted',
10✔
50
            'Memory size',
10✔
51
            'Key',
10✔
52
        ];
10✔
53

54
        $table = new Table($output);
10✔
55
        $table
10✔
56
            ->setHeaders($header)
10✔
57
            ->setRows($this->processFilelist($info['cache_list']))
10✔
58
        ;
10✔
59

60
        $table->render();
10✔
61

62
        return 0;
10✔
63
    }
64

65
    protected function processFileList(array $cacheList)
66
    {
67
        $list = [];
10✔
68

69
        foreach ($cacheList as $item) {
10✔
70
            $list[] = [
×
71
                number_format($item['num_hits']),
×
72
                $item['access_time'] > 0 ? 'Yes' : 'No',
×
73
                $item['deletion_time'] > 0 ? 'Yes' : 'No',
×
74
                Formatter::bytes($item['mem_size']),
×
75
                $item['info'],
×
76
            ];
×
77
        }
78

79
        return $list;
10✔
80
    }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc