コード例 #1
0
ファイル: http.php プロジェクト: daodaoliang/nooku-framework
 /**
  * Force creation of a singleton
  *
  * @param  KObjectConfigInterface  $config  Configuration options
  * @param  KObjectManagerInterface $manager A KObjectManagerInterface object
  * @return KDispatcherDefault
  */
 public static function getInstance(KObjectConfigInterface $config, KObjectManagerInterface $manager)
 {
     //Merge alias configuration into the identifier
     $config->append($manager->getIdentifier('dispatcher')->getConfig());
     //Create the singleton
     $class = $manager->getClass($config->object_identifier);
     $instance = new $class($config);
     //Add the object alias to allow easy access to the singleton
     $manager->registerAlias($config->object_identifier, 'dispatcher');
     return $instance;
 }