#!/usr/bin/env php
<?php

declare(strict_types=1);

if (PHP_SAPI !== 'cli') {
    fwrite(STDERR, "Gateway CLI only." . PHP_EOL);
    exit(1);
}

define('GATEWAY_BASE_PATH', dirname(__DIR__));
require GATEWAY_BASE_PATH . '/src/Support/bootstrap.php';

use Gateway\Bootstrap\Application;

try {
    $application = new Application();
    exit($application->run($_SERVER['argv'] ?? []));
} catch (Throwable $exception) {
    fwrite(STDERR, $exception->getMessage() . PHP_EOL);
    exit(1);
}
