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

miaoxing / plugin / 4887734704

pending completion
4887734704

push

github

semantic-release-bot
chore(release): publish

855 of 2264 relevant lines covered (37.77%)

18.44 hits per line

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

0.0
/src/Command/CacheClear.php
1
<?php
2

3
namespace Miaoxing\Plugin\Command;
4

5
use InvalidArgumentException;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Wei\BaseCache;
8

9
/**
10
 * @mixin \CacheMixin
11
 */
12
class CacheClear extends BaseCommand
13
{
14
    protected function configure()
15
    {
16
        $this->setDescription('Clear the cache')
×
17
            ->addArgument('driver', InputArgument::OPTIONAL, 'The service name of the cache');
×
18
    }
19

20
    protected function handle()
21
    {
22
        $driver = $this->getArgument('driver');
×
23

24
        if ($driver) {
×
25
            $cache = $this->wei->get($driver);
×
26
            if (!$cache instanceof BaseCache) {
×
27
                throw new InvalidArgumentException(sprintf('Driver "%s" is not a instance of BaseCache', $driver));
×
28
            }
29
        } else {
30
            $cache = $this->cache;
×
31
        }
32

33
        $cache->clear();
×
34
        $this->suc('Cleared the cache!');
×
35
    }
36
}
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

© 2025 Coveralls, Inc