当前位置: 首页>>代码示例>>PHP>>正文


PHP KServiceInterface::set方法代码示例

本文整理汇总了PHP中KServiceInterface::set方法的典型用法代码示例。如果您正苦于以下问题:PHP KServiceInterface::set方法的具体用法?PHP KServiceInterface::set怎么用?PHP KServiceInterface::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KServiceInterface的用法示例。


在下文中一共展示了KServiceInterface::set方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 /**
  * Force creation of a singleton
  *
  * @param KConfigInterface 	$config    An optional KConfig object with configuration options
  * @param KServiceInterface	$container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $query = $container->get('repos://site/components.component')->getQuery();
         $registry = $container->get('application.registry');
         $cached = $registry->offsetExists('assignable-components');
         if ($cached) {
             $query->component($registry->offsetGet('assignable-components'));
         }
         //check the cache
         $container->get('repos://site/components.component')->getCommandChain()->disable();
         $components = $container->get('repos://site/components.component')->fetch($query, AnDomain::FETCH_ENTITY_LIST);
         $container->get('repos://site/components.component')->getCommandChain()->enable();
         if (!$cached) {
             $assignables = array();
             $names = array();
             foreach ($components as $component) {
                 if ($component->isAssignable()) {
                     $names[] = $component->component;
                     $assignables[] = $component;
                 }
             }
             $components = $assignables;
             $registry['assignable-components'] = $names;
         }
         $instance = $container->get('anahita:domain.entityset', array('data' => $components, 'repository' => 'repos://site/components.component'));
         $container->set($config->service_identifier, $instance);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:38,代码来源:assignablecomponent.php

示例2: getInstance

 /**
  * Force creation of a singleton
  *
  * @param 	object 	An optional KConfig object with configuration options
  * @param 	object	A KServiceInterface object
  * @return ComDebugProfilerEvents
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $instance = new self($config);
         $container->set($config->service_identifier, $instance);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:15,代码来源:queries.php

示例3: getInstance

 /**
  * Return.
  *
  * @param KConfigInterface  $config    An optional KConfig object with configuration options
  * @param KServiceInterface $container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $identifier = self::_identifier($config->service_identifier);
         $instance = AnDomain::getRepository($identifier, $config->toArray());
         $container->set($config->service_identifier, $instance);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:17,代码来源:repository.php

示例4: getInstance

 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     // Singleton behavior.
     $identifier = $config->service_identifier;
     $classname = $identifier->classname;
     $instance = new $classname($config);
     $container->set($identifier, $instance);
     return $instance;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:9,代码来源:abstract.php

示例5: getInstance

 /**
  * Force creation of a singleton.
  *
  * @param KConfigInterface  $config    An optional KConfig object with configuration options
  * @param KServiceInterface $container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     JPluginHelper::importPlugin('storage');
     if (!$container->has($config->service_identifier)) {
         $classname = $config->service_identifier->classname;
         $instance = new PlgStorageLocal($config);
         $container->set($config->service_identifier, $instance);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:18,代码来源:default.php

示例6: getInstance

 /**
  * Force creation of a singleton.
  *
  * @param KConfigInterface  $config    An optional KConfig object with configuration options
  * @param KServiceInterface $container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $classname = $config->service_identifier->classname;
         $instance = new $classname($config);
         $container->set($config->service_identifier, $instance);
         $container->setAlias('application.dispatcher', $config->service_identifier);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:18,代码来源:application.php

示例7: getInstance

 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         //Create the singleton
         $classname = $config->service_identifier->classname;
         $instance = new $classname($config);
         $container->set($config->service_identifier, $instance);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:10,代码来源:activity.php

示例8: getInstance

 /**
  * Force creation of a singleton
  *
  * @param 	object 	An optional KConfig object with configuration options
  * @param 	object	A KServiceInterface object
  * @return KDispatcherDefault
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     // Check if an instance with this identifier already exists or not
     if (!$container->has($config->service_identifier)) {
         //Create the singleton
         $classname = $config->service_identifier->classname;
         $instance = new $classname($config);
         $container->set($config->service_identifier, $instance);
         //Add the factory map to allow easy access to the singleton
         $container->setAlias('dispatcher', $config->service_identifier);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:Roma48,项目名称:mayak,代码行数:20,代码来源:dispatcher.php

示例9: getInstance

 /**
  * Force creation of a singleton.
  *
  * @param KConfigInterface  $config    An optional KConfig object with configuration options
  * @param KServiceInterface $container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $id = JFactory::getUser()->id;
         if (!$id) {
             $viewer = $container->get('repos://site/people.person')->getEntity()->setData(array('userType' => ComPeopleDomainEntityPerson::USERTYPE_GUEST), AnDomain::ACCESS_PROTECTED);
             $viewer->set('id', 0);
             $viewer->getRepository()->extract($viewer);
         } else {
             $viewer = $container->get('repos://site/people.person')->find(array('userId' => $id));
         }
         $container->set($config->service_identifier, $viewer);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:23,代码来源:viewer.php

示例10: getInstance

 /**
  * Force creation of a singleton
  *
  * @param KConfigInterface 	$config    An optional KConfig object with configuration options
  * @param KServiceInterface	$container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $registry = $container->get('application.registry', array('key' => $config->service_identifier));
         if (!$registry->offsetExists('aggregations')) {
             $components = $container->get('repos://site/components.component')->fetchSet();
             $dispatcher = $container->get('koowa:event.dispatcher');
             $components->registerEventDispatcher($dispatcher);
             $aggregations = new KConfig();
             $event = new KEvent(array('aggregations' => $aggregations));
             $dispatcher->dispatchEvent('onStoryAggregation', $event);
             $registry->offsetSet('aggregations', $aggregations);
         }
         $container->set($config->service_identifier, $registry->offsetGet('aggregations'));
     }
     return $container->get($config->service_identifier);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:25,代码来源:aggregations.php

示例11: getInstance

 /**
  * Force creation of a singleton
  *
  * @param KConfigInterface 	$config    An optional KConfig object with configuration options
  * @param KServiceInterface	$container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $id = JFactory::getUser()->id;
         if (!$id) {
             $viewer = $container->get('repos://site/people.person')->getEntity()->setData(array('userType' => 'Guest'), AnDomain::ACCESS_PROTECTED);
             $viewer->set('id', 0);
             $viewer->getRepository()->extract($viewer);
         } else {
             $viewer = $container->get('repos://site/people.person')->find(array('userId' => $id));
             if (!$viewer) {
                 $viewer = $container->get('com://site/people.helper.person')->createFromUser(JFactory::getUser());
                 $viewer->save();
             }
         }
         $container->set($config->service_identifier, $viewer);
     }
     return $container->get($config->service_identifier);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:27,代码来源:viewer.php

示例12: getInstance

 /**
  * Force creation of a singleton
  *
  * @param KConfigInterface 	$config    An optional KConfig object with configuration options
  * @param KServiceInterface	$container A KServiceInterface object
  *
  * @return KServiceInstantiatable
  */
 public static function getInstance(KConfigInterface $config, KServiceInterface $container)
 {
     if (!$container->has($config->service_identifier)) {
         $registry = $container->get('application.registry', array('key' => $config->service_identifier));
         if (!$registry->offsetExists('scopes')) {
             $components = $container->get('repos://site/components.component')->fetchSet();
             $dispatcher = $container->get('koowa:event.dispatcher');
             $components->registerEventDispatcher($dispatcher);
             $event = new KEvent(array('scope' => array()));
             $dispatcher->dispatchEvent('onBeforeFetch', $event);
             $scopes = new self();
             foreach ($event->scope as $scope) {
                 $scope = KConfig::unbox($scope);
                 if (is_array($scope)) {
                     $scope = $container->get('com://site/components.domain.entity.scope', $scope);
                 }
                 $scopes[$scope->getKey()] = $scope;
             }
             $registry->offsetSet('scopes', $scopes);
         }
         $container->set($config->service_identifier, $registry->offsetGet('scopes'));
     }
     return $container->get($config->service_identifier);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:32,代码来源:scope.php


注:本文中的KServiceInterface::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。