PHP Class phprs\util\IoCFactoryEx

.. 1. 创建的是指定类的容器实例,而不是类的实例 2. 在第一次调用时才创建类的实例 3. 支持@cache注释,对类的接口进行缓存
Author: caoym
Inheritance: extends IoCFactory
Show file Open project: caoym/phprs-restful

Public Methods

Method Description
__construct ( $conf = null, $dict = null, $metas = null )
create ( string $id, array $construct_args = null, array $properties = null, callable $injector = null, callable $init = null ) : object 根据id创建对象(的容器)实例
createRawObject ( string $id, array $construct_args = null, array $properties = null, callable $injector = null, callable $init = null ) : object 根据id创建对象(的容器)实例, 不使用容器

Method Details

__construct() public method

public __construct ( $conf = null, $dict = null, $metas = null )

create() public method

根据id创建对象(的容器)实例
public create ( string $id, array $construct_args = null, array $properties = null, callable $injector = null, callable $init = null ) : object
$id string
$construct_args array 构造函数的参数
$properties array 类属性, 覆盖配置文件中的属性
$injector callable fun($src), 获取注入值的方法
$init callable fun($inst, &$got) 初始化实例, 在创建后, 调用构造函数前
return object

createRawObject() public method

根据id创建对象(的容器)实例, 不使用容器
public createRawObject ( string $id, array $construct_args = null, array $properties = null, callable $injector = null, callable $init = null ) : object
$id string
$construct_args array 构造函数的参数
$properties array 类属性, 覆盖配置文件中的属性
$injector callable fun($src), 获取注入值的方法
$init callable fun($inst, &$got) 初始化实例, 在创建后, 调用构造函数前
return object