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

/*
 * This file is part of Psy Shell.
 *
 * (c) 2012-2017 Justin Hileman
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

require_once '/usr/share/php/Psy/autoload.php';

// If the psysh binary was included directly, assume they just wanted an
// autoloader and bail early.
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
    $trace = debug_backtrace();
} elseif (version_compare(PHP_VERSION, '5.4.0', '<')) {
    $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
} else {
    $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
}

if (Psy\Shell::isIncluded($trace)) {
    unset($trace);

    return;
}

// Clean up after ourselves.
unset($trace);

// And go!
call_user_func(Psy\bin());
