#!/usr/bin/env php
<?php
/**
 * CoreShop.
 *
 * This source file is subject to the GNU General Public License version 3 (GPLv3)
 * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
 * files that are distributed with this source code.
 *
 * @copyright  Copyright (c) CoreShop GmbH (https://www.coreshop.com)
 * @license    https://www.coreshop.com/license     GPLv3 and CCL
 */

use Pimcore\Bootstrap;
use Pimcore\Console\Application;

if (file_exists($a = getcwd() . '/vendor/autoload_runtime.php')) {
    require_once $a;
} elseif (file_exists($a = __DIR__ . '/../vendor/autoload_runtime.php')) {
    require_once $a;
} elseif (file_exists($a = __DIR__ . '/../../../../vendor/autoload_runtime.php')) {
    require_once $a;
} elseif (file_exists($a = __DIR__ . '/../autoload_runtime.php')) {
    require_once $a;
} else {
    throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

define('PIMCORE_CONSOLE', true);

Bootstrap::setProjectRoot();

return static function (array $context) {
    $kernel = Bootstrap::startupCli();

    return new Application($kernel);
};