first commit

This commit is contained in:
2023-04-15 23:29:27 +08:00
commit 2d9ac93a7a
71 changed files with 4592 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
<?php
namespace Kiri\Message\Aspect;
/**
*
*/
abstract class AbstractsAspect implements OnAspectInterface
{
}
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Kiri\Message\Aspect;
/**
*
*/
class JoinPoint implements OnJoinPointInterface
{
/**
* @param array|\Closure $handler
* @param mixed $params
*/
public function __construct(public array|\Closure $handler, public array $params)
{
}
/**
* @return mixed
*/
public function process(): mixed
{
return call_user_func($this->handler, ...$this->params);
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace Kiri\Message\Aspect;
interface OnAspectInterface
{
/**
* @param OnJoinPointInterface $joinPoint
* @return mixed
*/
public function process(OnJoinPointInterface $joinPoint): mixed;
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace Kiri\Message\Aspect;
interface OnJoinPointInterface
{
public function process();
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Kiri\Message\Aspect;
class TestAspect extends AbstractsAspect
{
/**
* @param OnJoinPointInterface $joinPoint
* @return mixed
*/
public function process(OnJoinPointInterface $joinPoint): mixed
{
$result = $joinPoint->process();
var_dump('111');
return $result;
}
}