We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ee1ee81 commit 2509df9Copy full SHA for 2509df9
app/Commands/DetectCommand.php
@@ -8,16 +8,21 @@
8
9
class DetectCommand extends Command
10
{
11
- protected $signature = 'detect {code} {--debug} {--from-file=}';
+ protected $signature = 'detect {path} {--debug} {--from-file=}';
12
13
protected $description = 'Detect things we care about in the current code';
14
15
public function handle(): void
16
17
- $code = $this->argument('code');
18
-
19
if ($this->option('from-file')) {
20
$code = file_get_contents(__DIR__ . '/../../tests/snippets/detect/' . $this->option('from-file') . '.php');
+ } else {
+ try {
21
+ $code = file_get_contents($this->argument('path'));
22
+ } catch (\Exception $e) {
23
+ echo json_encode([]);
24
+ return;
25
+ }
26
}
27
28
$walker = new DetectWalker($code, (bool) $this->option('debug'));
0 commit comments