first commit
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Message\Aspect;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
abstract class AbstractsAspect implements OnAspectInterface
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Message\Aspect;
|
||||
|
||||
interface OnAspectInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param OnJoinPointInterface $joinPoint
|
||||
* @return mixed
|
||||
*/
|
||||
public function process(OnJoinPointInterface $joinPoint): mixed;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Kiri\Message\Aspect;
|
||||
|
||||
interface OnJoinPointInterface
|
||||
{
|
||||
|
||||
|
||||
public function process();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user