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

use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

if (!file_exists(dirname(__DIR__).'/vendor/autoload.php')) {
    throw new LogicException('Dependencies are not installed. Please run "composer install".');
}

require dirname(__DIR__).'/config/bootstrap.php';

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev');
$debug = $_SERVER['APP_DEBUG'] ?? ('prod' !== $env);

if ($debug) {
    umask(0000);
    Debug::enable();
}

$kernel = new Kernel($env, (bool) $debug);
$application = new Application($kernel);
$application->run($input);
