变更
This commit is contained in:
@@ -331,6 +331,9 @@ class Container implements ContainerInterface
|
|||||||
if (isset($this->_parameters[$className]) && isset($this->_parameters[$className][$method])) {
|
if (isset($this->_parameters[$className]) && isset($this->_parameters[$className][$method])) {
|
||||||
return $this->_parameters[$className][$method];
|
return $this->_parameters[$className][$method];
|
||||||
}
|
}
|
||||||
|
if (!TargetManager::has($className)) {
|
||||||
|
TargetManager::set($className, $this->getReflect($className));
|
||||||
|
}
|
||||||
$reflectMethod = $this->getReflectMethod($className, $method);
|
$reflectMethod = $this->getReflectMethod($className, $method);
|
||||||
if (!($reflectMethod instanceof ReflectionMethod)) {
|
if (!($reflectMethod instanceof ReflectionMethod)) {
|
||||||
throw new ReflectionException("Class does not have a function $className::$method");
|
throw new ReflectionException("Class does not have a function $className::$method");
|
||||||
|
|||||||
+9
-1
@@ -9,7 +9,6 @@ class TargetManager
|
|||||||
private static array $targets = [];
|
private static array $targets = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @return Target|null
|
* @return Target|null
|
||||||
@@ -20,6 +19,15 @@ class TargetManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $class
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function has(string $class): bool
|
||||||
|
{
|
||||||
|
return isset(static::$targets[$class]) && static::$targets[$class] !== null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @param \ReflectionClass $reflection
|
* @param \ReflectionClass $reflection
|
||||||
|
|||||||
Reference in New Issue
Block a user