This commit is contained in:
as2252258@163.com
2021-03-29 03:39:53 +08:00
parent dbaa7eb73c
commit 9ba40e5fd7
2 changed files with 4 additions and 7 deletions
+3 -6
View File
@@ -51,16 +51,13 @@ class Aop extends Component
return call_user_func($close, ...$get_args);
}
$reflect = new \ReflectionClass($this->_aop[$aopName]);
if (!$reflect->hasMethod('invoke')) {
$reflect = Snowflake::getDi()->getReflect($this->_aop[$aopName]);
if (!$reflect->isInstantiable() || !$reflect->hasMethod('invoke')) {
throw new \Exception(ASPECT_ERROR . IAspect::class);
}
$method = $reflect->getMethod('invoke');
$data = $method->invokeArgs($reflect->newInstance($close), $get_args);
if ($method->getReturnType() !== null) {
return $data;
}
return $method->invokeArgs($reflect->newInstance($close), $get_args);
}
+1 -1
View File
@@ -22,7 +22,7 @@ class LoggerAspect implements IAspect
* LoggerAspect constructor.
* @param array $handler
*/
public function __construct(public array $handler, $needReturn)
public function __construct(public array $handler)
{
$this->className = get_class($this->handler[0]);
$this->methodName = $this->handler[1];