Ejemplo n.º 1
0
 public function __construct(Context $context)
 {
     spl_autoload_register(array($this, "includeByClassName"));
     $this->includePaths = array_merge($context->getIncludePaths(), explode(PATH_SEPARATOR, get_include_path()));
     $this->classAliasRepository = new ClassAliasRepository();
     $this->objectFactory = new AbstractFactory($this);
 }
Ejemplo n.º 2
0
use classes\context\Context;
if (defined('PERMINATOR_TEST') && PERMINATOR_TEST) {
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    define("APP_ROOT", $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR);
    define("TEST", true);
    define('DEBUG', $runtimeDebug);
} elseif (isset($_SERVER) && is_array($_SERVER) && array_key_exists('DOCUMENT_ROOT', $_SERVER)) {
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    define("APP_ROOT", $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR);
    define("TEST", false);
    define('DEBUG', $runtimeDebug);
} elseif (isset($_ENV) && is_array($_ENV) && array_key_exists('ZEND_PHPUNIT_PROJECT_LOCATION', $_SERVER)) {
    // Zend Studio Test 환경
    define("APP_ROOT", $_ENV['ZEND_PHPUNIT_PROJECT_LOCATION'] . DIRECTORY_SEPARATOR);
    define("TEST", true);
    define('DEBUG', $runtimeDebug);
} else {
    echo 'Runtime 환경을 충족시키지 못하였습니다' . "\n";
    echo '$_SERVER 변수나 $_ENV["ZEND_PHPUNIT_PROJECT_LOCATION"]에 프로젝트 경로를 직접 넣어주십시오.' . "\n";
    exit;
}
require_once 'loader.php';
if (!TEST) {
    set_include_path(APP_ROOT);
    $Dispatcher = new DispatcherScript();
    $Dispatcher->doDispatch(Context::getSharedContext());
} elseif (!defined('PERMINATOR_TEST')) {
    PerminatorClassLoader::getClassLoader(Context::getSharedContext());
}