Current File : /var/www/vinorea/modules/psxdesign/vendor/humbug/php-scoper/bin/php-scoper
#!/usr/bin/env php
<?php

/*
 * This file is part of the humbug/php-scoper package.
 *
 * Copyright (c) 2017 Théo FIDRY <theo.fidry@gmail.com>,
 *                    Pádraic Brady <padraic.brady@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Humbug\PhpScoper;

use ErrorException;
use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder;
use RuntimeException;
use Symfony\Component\Finder\Finder;

if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
    echo PHP_EOL.'PHP-Scoper may only be invoked from a command line'.\PHP_EOL;

    exit(1);
}

set_error_handler(
    static function (int $code, string $message, string $file = '', int $line = -1): void {
        if (error_reporting() & $code) {
            throw new ErrorException($message, 0, $code, $file, $line);
        }
    }
);

$findAutoload = static function () {
    if (file_exists($autoload = __DIR__.'/../../../autoload.php')) {
        // Is installed via composer
        return $autoload;
    }

    if (file_exists($autoload = __DIR__.'/../vendor/autoload.php')) {
        // Is installed locally
        return $autoload;
    }

    throw new RuntimeException('Unable to find the Composer autoloader.');
};

$autoload = $findAutoload();

require $autoload;

// Exposes the finder used by PHP-Scoper PHAR to allow its usage in the configuration file.
if (false === class_exists(IsolatedFinder::class)) {
    class_alias(Finder::class, IsolatedFinder::class);
}

create_application()->run();