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


PHP AppContext::service方法代码示例

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


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

示例1: resolveViewName

 function resolveViewName($viewName, $locale)
 {
     if (!AppContext::service_exists($viewName)) {
         // Allow for ViewResolver chaining.
         return null;
     }
     return AppContext::service($viewName);
 }
开发者ID:qlixes,项目名称:springphp,代码行数:8,代码来源:BeanNameViewResolver.php

示例2: log_enabled

function log_enabled($level)
{
    $log =& AppContext::service('Log');
    if ($log != null) {
        return $log->enabled($level);
    } else {
        return false;
    }
}
开发者ID:qlixes,项目名称:springphp,代码行数:9,代码来源:libraries.php

示例3: HandlerExecutionChain

 function &getHandler(&$request)
 {
     $handler =& $this->getHandlerInternal($request);
     if ($handler == null) {
         $handler =& $this->defaultHandler;
     }
     if ($handler == null) {
         return $handler;
     }
     // Service name or resolved handler?
     if (is_string($handler)) {
         $handler =& AppContext::service($handler);
     }
     $hec =& new HandlerExecutionChain(&$handler, &$this->interceptors);
     return $hec;
 }
开发者ID:qlixes,项目名称:springphp,代码行数:16,代码来源:HandlerMapping.php

示例4: _resolveService

 function _resolveService($serviceName)
 {
     if ($this->{$serviceName} == NULL) {
         $this->{$serviceName} =& AppContext::service($serviceName);
         if ($this->{$serviceName} == NULL) {
             $this->{$serviceName} =& $this->_getDefaultStrategy($serviceName);
         }
     }
     if (log_enabled(LOG_DEBUG)) {
         log_message(LOG_DEBUG, 'Using ' . $serviceName . ' [' . get_class($this->{$serviceName}) . ']');
     }
 }
开发者ID:qlixes,项目名称:springphp,代码行数:12,代码来源:Dispatcher.php

示例5: _null

 function &instantiate()
 {
     if ($this->className == null) {
         return _null();
     }
     if (!class_exists($this->className)) {
         if (!is_file($this->base . $this->filename) || !file_exists($this->base . $this->filename)) {
             show_error('Instantiator Error', "File not found for '{$this->className}': " . $this->base . $this->filename);
         }
         include $this->base . $this->filename;
     }
     $class = $this->className;
     if (!is_array($this->definition)) {
         $instance =& new $class();
     } else {
         # parameters
         $parameters = false;
         if (isset($this->definition['parameters'])) {
             if (!is_array($parameters = $this->definition['parameters'])) {
                 $parameters = array($parameters);
             }
         }
         # instantiate
         if (!$parameters) {
             $instance =& new $class();
         } else {
             $instance =& $this->_create_obj_array($class, $parameters);
         }
         # autowire?
         if (isset($this->definition['autowire']) && $this->definition['autowire'] == true) {
             $vars = get_object_vars($instance);
             foreach ($vars as $name => $val) {
                 $service =& AppContext::service($name);
                 if ($service != null) {
                     $instance->{$name} =& $service;
                 }
             }
         }
         # properties
         if (isset($this->definition['properties'])) {
             $properties = array_map(array(&$this, '_get_typed_value'), $this->definition['properties']);
             foreach ($properties as $name => $value) {
                 $instance->{$name} =& $properties[$name];
             }
         }
         # invoke
         if (isset($this->definition['invoke'])) {
             foreach ($this->definition['invoke'] as $name => $value) {
                 if (!is_array($value)) {
                     $value = array($value);
                 }
                 call_user_func_array(array(&$instance, $name), $value);
             }
         }
         # initialize-method
         if (isset($this->definition['initialize-method'])) {
             call_user_func(array(&$instance, $this->definition['initialize-method']));
         }
     }
     return $instance;
 }
开发者ID:qlixes,项目名称:springphp,代码行数:61,代码来源:Instantiator.php


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