예제 #1
0
파일: Rails.php 프로젝트: railsphp/railsphp
 private static function setRailsConfig()
 {
     $paths = array_merge([get_include_path(), self::$root . '/lib', self::$root . '/vendor']);
     set_include_path(implode(PATH_SEPARATOR, $paths));
     # Set loader.
     require self::$path . '/Loader/Loader.php';
     self::$loader = new Rails\Loader\Loader([dirname(self::$path), self::$config->paths->models->toString(), self::$config->paths->helpers, self::$config->paths->controllers->toString(), self::$config->paths->mailers->toString(), self::$root . '/lib', self::$root . '/vendor']);
     # Set Composer autoloader.
     $autoloadFile = defined("COMPOSER_AUTOLOADER") ? COMPOSER_AUTOLOADER : Rails::root() . '/vendor/autoload.php';
     self::$loader->setComposerAutoload(require $autoloadFile);
     spl_autoload_register([Rails::loader(), 'loadClass']);
     set_exception_handler('Rails::exceptionHandler');
     register_shutdown_function('Rails::runSystemExit');
     # This will be re-set in Rails_Application, setting also the customized second parameter.
     set_error_handler('Rails::errorHandler', E_ALL);
 }