Issues (4)

src/Commands/Commands.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace Peac36\Explorer\Commands;
4
5
use App\Console\Kernel;
0 ignored issues
show
The type App\Console\Kernel 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;
0 ignored issues
show
The type Illuminate\Console\Command 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...
7
8
class Commands extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'explore:commands';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Prints all registered commands.';
23
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return mixed
38
     */
39
    public function handle()
40
    {
41
        $laravel = $this->getLaravel();
42
        $commands = $laravel->make(Kernel::class)->all();
43
        $base_path = $laravel->basePath();
44
45
        $rows = array_map(function($command, $comand_name) use($base_path) {
46
            $reflection = new \ReflectionClass($command);
47
            return [
48
                'name' => $comand_name,
49
                'command' => $reflection->getName(),
50
                'path' => str_replace($base_path, '', $reflection->getFileName()),
51
            ];
52
        }, $commands, array_keys($commands));
53
54
        $this->table([], $rows);
55
    }
56
}
57