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

Jagepard / Rudra-Cli / 15920986328

27 Jun 2025 07:42AM UTC coverage: 4.771% (-95.2%) from 100.0%
15920986328

push

github

web-flow
Merge pull request #29 from Jagepard/wip

adds commands

0 of 479 new or added lines in 20 files covered. (0.0%)

24 of 503 relevant lines covered (4.77%)

0.12 hits per line

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

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

3
namespace Rudra\Cli\Command;
4

5
use Rudra\Cli\Command\ConsoleFacade as Cli;
6
use Rudra\Auth\AuthFacade as Auth;
7
use Rudra\Container\Facades\Request;
8

9
class CacheClearCommand
10
{
NEW
11
    public function actionIndex(): void
×
12
    {
NEW
13
        Cli::printer("Enter cache type [database, routes, templates](empty for all): ", "magneta");
×
NEW
14
        $type = str_replace(PHP_EOL, "", Cli::reader());
×
15

NEW
16
        $folderPath = !empty($type)
×
NEW
17
            ? dirname(__DIR__, 2) . "/cache/$type"
×
NEW
18
            : dirname(__DIR__, 2) . "/cache";
×
19

NEW
20
        if ($this->deleteDirectory($folderPath)) {
×
NEW
21
            Cli::printer(!empty($type)
×
NEW
22
                ? "✅ Cache $type was cleared" . PHP_EOL
×
NEW
23
                : "✅ Cache was cleared" . PHP_EOL, "light_green");
×
24
        } else {
NEW
25
            Cli::printer(!empty($type)
×
NEW
26
                ? "❌ Cache type '$type' does not exist." . PHP_EOL
×
NEW
27
                : "⚠️  The directory does not exist or the cache was cleared." . PHP_EOL, !empty($type) ? "red" : "yellow");
×
28
        }
29
    }
30

31
    /**
32
     * @param string $dir
33
     * @return bool
34
     */
NEW
35
    private function deleteDirectory(string $dir): bool
×
36
    {
NEW
37
        if (!is_dir($dir)) {
×
NEW
38
            return false;
×
39
        }
40

NEW
41
        foreach (glob($dir . '/*') as $file) {
×
NEW
42
            is_dir($file) ? $this->deleteDirectory($file) : unlink($file);
×
43
        }
44

NEW
45
        return rmdir($dir);
×
46
    }
47
}
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