Yii-get
2016-08-01 14:17:07 3 举报
Yii
作者其他创作
大纲/内容
N
return $object
end
Y
get
$this-_singletons[$class]
foreach ($dependencies as $index = $dependency)
$definition = $this-_definitions[$class];
is_array($definition)
is_object($definition)
$reflection = new ReflectionClass($class);
$reflection-newInstanceArgs($dependencies)
throw
isset $this-_definitions[$class]
$concrete = $definition['class']
如果 $dependency 是Instance的实例,调用$this-get($dependency-id) 获取实例并覆盖$dependencies 原来的值,
$constructor = $reflection-getConstructor();解析 构造方法参数,如果参数是对象,则创建 Instance实例,返回反射类实例 和 构造方法参数
$concrete === $class
getDependencies($class)
$this-get($dependency-id);
isset _singletons[$class]
0 条评论
下一页