modify
This commit is contained in:
+3
-6
@@ -51,16 +51,13 @@ class Aop extends Component
|
|||||||
return call_user_func($close, ...$get_args);
|
return call_user_func($close, ...$get_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
$reflect = new \ReflectionClass($this->_aop[$aopName]);
|
$reflect = Snowflake::getDi()->getReflect($this->_aop[$aopName]);
|
||||||
if (!$reflect->hasMethod('invoke')) {
|
if (!$reflect->isInstantiable() || !$reflect->hasMethod('invoke')) {
|
||||||
throw new \Exception(ASPECT_ERROR . IAspect::class);
|
throw new \Exception(ASPECT_ERROR . IAspect::class);
|
||||||
}
|
}
|
||||||
$method = $reflect->getMethod('invoke');
|
$method = $reflect->getMethod('invoke');
|
||||||
|
|
||||||
$data = $method->invokeArgs($reflect->newInstance($close), $get_args);
|
return $method->invokeArgs($reflect->newInstance($close), $get_args);
|
||||||
if ($method->getReturnType() !== null) {
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class LoggerAspect implements IAspect
|
|||||||
* LoggerAspect constructor.
|
* LoggerAspect constructor.
|
||||||
* @param array $handler
|
* @param array $handler
|
||||||
*/
|
*/
|
||||||
public function __construct(public array $handler, $needReturn)
|
public function __construct(public array $handler)
|
||||||
{
|
{
|
||||||
$this->className = get_class($this->handler[0]);
|
$this->className = get_class($this->handler[0]);
|
||||||
$this->methodName = $this->handler[1];
|
$this->methodName = $this->handler[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user