#!/usr/bin/env php
<?php
/**
 * Pimcore
 *
 * This source file is available under two different licenses:
 * - GNU General Public License version 3 (GPLv3)
 * - Pimcore Enterprise License (PEL)
 * Full copyright and license information is available in
 * LICENSE.md which is distributed with this source code.
 *
 * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
 * @license    http://www.pimcore.org/license     GPLv3 and PEL
 */

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 function (array $context) {
    $kernel = Bootstrap::startupCli();

    return new Application($kernel);
};
