Ajoute le parser Orpi

This commit is contained in:
2020-11-09 17:35:50 +01:00
committed by Gogs
parent 020cd78822
commit 4b9ca23dff
5 changed files with 216 additions and 3 deletions

View File

@@ -3,7 +3,9 @@
namespace App\Console\Commands;
use App\Parser;
use GuzzleHttp\Exception\InvalidArgumentException;
use Illuminate\Console\Command;
use function GuzzleHttp\json_encode;
class ParseLinkCommand extends Command
{
@@ -39,7 +41,11 @@ class ParseLinkCommand extends Command
public function handle()
{
$parser = Parser::factory($this->argument('url'));
$parser->parse();
try {
$this->info(json_encode($parser->parse(), true));
} catch (InvalidArgumentException $e) {
$this->error($e->getMessage());
}
return 0;
}