コード例 #1
0
 /**
  * Force creation of a singleton
  *
  * @param 	ObjectConfig            $config	  A ObjectConfig object with configuration options
  * @param 	ObjectManagerInterface	$manager  A ObjectInterface object
  * @return DispatcherRequest
  */
 public static function getInstance(ObjectConfig $config, ObjectManagerInterface $manager)
 {
     if (!$manager->isRegistered('user.session')) {
         $classname = $config->object_identifier->classname;
         $instance = new $classname($config);
         $manager->setObject($config->object_identifier, $instance);
         $manager->registerAlias('user.session', $config->object_identifier);
     }
     return $manager->getObject('user.session');
 }
コード例 #2
0
ファイル: component.php プロジェクト: janssit/nickys.janss.be
 /**
  * Force creation of a singleton
  *
  * @param 	ObjectConfig            $config	  A ObjectConfig object with configuration options
  * @param 	ObjectManagerInterface	$manager  A ObjectInterface object
  * @return DispatcherComponent
  */
 public static function getInstance(ObjectConfig $config, ObjectManagerInterface $manager)
 {
     if (!$manager->isRegistered($config->object_identifier)) {
         $classname = $config->object_identifier->classname;
         $instance = new $classname($config);
         $manager->setObject($config->object_identifier, $instance);
         //Add the service alias to allow easy access to the singleton
         $manager->registerAlias('component', $config->object_identifier);
     }
     return $manager->getObject($config->object_identifier);
 }
コード例 #3
0
 /**
  * Force creation of a singleton
  *
  * @param 	ObjectConfig            $config	  A ObjectConfig object with configuration options
  * @param 	ObjectManagerInterface	$manager  A ObjectInterface object
  * @return DispatcherRequest
  */
 public static function getInstance(ObjectConfig $config, ObjectManagerInterface $manager)
 {
     if (!$manager->isRegistered('dispatcher.response')) {
         //Create the singleton
         $classname = $config->object_identifier->classname;
         $instance = new $classname($config);
         $manager->setObject($config->object_identifier, $instance);
         //Add the object alias to allow easy access to the singleton
         $manager->registerAlias('dispatcher.response', $config->object_identifier);
         $manager->registerAlias('response', 'dispatcher.response');
     }
     return $manager->getObject('dispatcher.response');
 }