modify
This commit is contained in:
+3
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user