/** * Get or create the singleton alias loader instance. * * @param array $aliases * @return \Nickfan\AppBox\Foundation\AliasLoader */ public static function getInstance(array $aliases = array()) { if (is_null(static::$instance)) { static::$instance = new static($aliases); } $aliases = array_merge(static::$instance->getAliases(), $aliases); static::$instance->setAliases($aliases); return static::$instance; }
|-------------------------------------------------------------------------- | | By default, we use short keys in the container for each of the core | pieces of the framework. Here we will register the aliases for a | list of all of the fully qualified class names making DI easy. | */ $boxapp->registerCoreContainerAliases(); //$userCacheObject = new AutoBoxUsercache(); $userCacheObject = $boxapp->makeUserCacheInstance(); $boxapp->instance('usercache', $userCacheObject); $boxapp->instance('boxdict', $dict = new BoxDictionary(array())); $boxapp->instance('boxconf', $config = new BoxRepository($boxapp['path.storage'] . '/conf', $userCacheObject)); $boxapp->instance('boxrouteconf', $routeconf = new BoxRouteConf($boxapp['path.storage'] . '/etc/local', $userCacheObject)); $boxapp->instance('boxrouteinst', $routeinstance = BoxRouteInstance::getInstance($routeconf)); date_default_timezone_set($boxapp['boxconf']['app']['timezone']); /* |-------------------------------------------------------------------------- | Register The Alias Loader |-------------------------------------------------------------------------- | | The alias loader is responsible for lazy loading the class aliases setup | for the application. We will only register it if the "config" service | is bound in the application since it contains the alias definitions. | */ AliasLoader::getInstance($boxapp['boxconf']['app']['aliases'])->register(); } return $boxapp; })); return $boxapp;