Issues (516)

app/Console/Commands/RemoveCrapReleases.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Console\Commands;
4
5
use Blacklight\ReleaseRemover;
0 ignored issues
show
The type Blacklight\ReleaseRemover was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Console\Command;
7
8
class RemoveCrapReleases extends Command
9
{
10
    protected $signature = 'releases:remove-crap
11
                            {--type= : Type of crap to remove}
12
                            {--time=full : Time limit in hours or full}
13
                            {--blacklist-id= : Specific blacklist ID}
14
                            {--delete : Actually delete releases}';
15
16
    protected $description = 'Remove crap releases based on various criteria';
17
18
    public function __construct()
19
    {
20
        parent::__construct();
21
    }
22
23
    public function handle(): int
24
    {
25
        $type = $this->option('type') ?? '';
26
        $time = $this->option('time') ?? 'full';
27
        $blacklistId = $this->option('blacklist-id') ?? '';
28
        $delete = $this->option('delete');
29
30
        if (! $delete) {
31
            $this->warn('Running in DRY-RUN mode. Use --delete to actually remove releases.');
32
        }
33
34
        try {
35
            $remover = new ReleaseRemover;
36
            $result = $remover->removeCrap($delete, $time, $type, $blacklistId);
37
38
            if ($result === true) {
39
                return self::SUCCESS;
40
            }
41
42
            $this->error($result);
43
44
            return self::FAILURE;
45
        } catch (\Exception $e) {
46
            $this->error($e->getMessage());
47
48
            return self::FAILURE;
49
        }
50
    }
51
}
52