Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joetannenbaum committed Dec 18, 2024
1 parent ee1ee81 commit 2509df9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/Commands/DetectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@

class DetectCommand extends Command
{
protected $signature = 'detect {code} {--debug} {--from-file=}';
protected $signature = 'detect {path} {--debug} {--from-file=}';

protected $description = 'Detect things we care about in the current code';

public function handle(): void
{
$code = $this->argument('code');

if ($this->option('from-file')) {
$code = file_get_contents(__DIR__ . '/../../tests/snippets/detect/' . $this->option('from-file') . '.php');
} else {
try {
$code = file_get_contents($this->argument('path'));
} catch (\Exception $e) {
echo json_encode([]);
return;
}
}

$walker = new DetectWalker($code, (bool) $this->option('debug'));
Expand Down

0 comments on commit 2509df9

Please sign in to comment.