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

eliashaeussler / cpanel-requests / 12019847339

25 Nov 2024 08:30PM UTC coverage: 99.497%. Remained the same
12019847339

push

github

web-flow
[TASK] Update eliashaeussler/php-cs-fixer-config to v2.2.1

| datasource | package                            | from  | to    |
| ---------- | ---------------------------------- | ----- | ----- |
| packagist  | eliashaeussler/php-cs-fixer-config | 2.2.0 | 2.2.1 |

396 of 398 relevant lines covered (99.5%)

9.3 hits per line

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

100.0
/src/Command/CleanupLogsCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the Composer package "eliashaeussler/cpanel-requests".
7
 *
8
 * Copyright (C) 2020-2024 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 3 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\CpanelRequests\Command;
25

26
use EliasHaeussler\CpanelRequests\Resource;
27
use Symfony\Component\Console;
28

29
use function count;
30

31
/**
32
 * CleanupLogsCommand.
33
 *
34
 * @author Elias Häußler <elias@haeussler.dev>
35
 * @license GPL-3.0-or-later
36
 */
37
final class CleanupLogsCommand extends Console\Command\Command
38
{
39
    protected function configure(): void
3✔
40
    {
41
        $this
3✔
42
            ->setName('cleanup:logs')
3✔
43
            ->setDescription('Clear log files')
3✔
44
            ->setHelp('This command clears all log files.')
3✔
45
        ;
3✔
46
    }
47

48
    protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output): int
3✔
49
    {
50
        $io = new Console\Style\SymfonyStyle($input, $output);
3✔
51

52
        $clearedLogFiles = Resource\Log::removeAll();
3✔
53
        $count = count($clearedLogFiles);
3✔
54

55
        if ($io->isVerbose() && $count > 0) {
3✔
56
            $io->writeln('The following log files have been removed:');
1✔
57
            $io->listing(array_map(self::decorateFile(...), $clearedLogFiles));
1✔
58
        }
59

60
        $io->success(sprintf('Cleared %s log file%s.', $count, 1 !== $count ? 's' : ''));
3✔
61

62
        return self::SUCCESS;
3✔
63
    }
64

65
    private static function decorateFile(Resource\File $file): string
1✔
66
    {
67
        return $file->getPathname();
1✔
68
    }
69
}
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