改名
This commit is contained in:
@@ -38,7 +38,7 @@ defined('ASPECT_ERROR') or define('ASPECT_ERROR', 'Aspect annotation must implem
|
|||||||
throw new Exception(ASPECT_ERROR . IAspect::class);
|
throw new Exception(ASPECT_ERROR . IAspect::class);
|
||||||
}
|
}
|
||||||
/** @var Aop $aop */
|
/** @var Aop $aop */
|
||||||
$aop = Snowflake::app()->get('aop');
|
$aop = Snowflake::app()->get(Aop::class);
|
||||||
|
|
||||||
$aop->aop_add([$class, $method], $this->aspect);
|
$aop->aop_add([$class, $method], $this->aspect);
|
||||||
|
|
||||||
|
|||||||
@@ -163,8 +163,7 @@ class Node extends HttpService
|
|||||||
private function createDispatch(): Closure
|
private function createDispatch(): Closure
|
||||||
{
|
{
|
||||||
/** @var Aop $aop */
|
/** @var Aop $aop */
|
||||||
$aop = Snowflake::app()->get('aop');
|
$aop = Snowflake::app()->get(Aop::class);
|
||||||
var_dump($this->path . '->' . (int)$aop->hasAop($this->handler));
|
|
||||||
if ($this->handler instanceof Closure || !$aop->hasAop($this->handler)) {
|
if ($this->handler instanceof Closure || !$aop->hasAop($this->handler)) {
|
||||||
return $this->normalHandler($this->handler);
|
return $this->normalHandler($this->handler);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class Aop extends Component
|
|||||||
if (!isset(static::$_aop[$alias])) {
|
if (!isset(static::$_aop[$alias])) {
|
||||||
static::$_aop[$alias] = [];
|
static::$_aop[$alias] = [];
|
||||||
}
|
}
|
||||||
|
var_dump($alias, $aspect);
|
||||||
if (in_array($aspect, static::$_aop[$alias])) {
|
if (in_array($aspect, static::$_aop[$alias])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -10,6 +10,7 @@ use HttpServer\Http\Response;
|
|||||||
use HttpServer\Route\Router;
|
use HttpServer\Route\Router;
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Abstracts\Config;
|
use Snowflake\Abstracts\Config;
|
||||||
|
use Snowflake\Aop;
|
||||||
use Snowflake\Application;
|
use Snowflake\Application;
|
||||||
use Snowflake\Core\ArrayAccess;
|
use Snowflake\Core\ArrayAccess;
|
||||||
use Snowflake\Core\Json;
|
use Snowflake\Core\Json;
|
||||||
@@ -312,7 +313,7 @@ if (!function_exists('aop')) {
|
|||||||
*/
|
*/
|
||||||
function aop(mixed $handler, array $params = []): mixed
|
function aop(mixed $handler, array $params = []): mixed
|
||||||
{
|
{
|
||||||
return Snowflake::app()->get('aop')->dispatch($handler, $params);
|
return Snowflake::getDi()->get(Aop::class)->dispatch($handler, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user