AspectContext
This commit is contained in:
parent
6050e3bb72
commit
d35c3df06d
8 changed files with 70 additions and 19 deletions
|
|
@ -3,19 +3,25 @@
|
|||
namespace Tests\Aspects;
|
||||
|
||||
use Attribute;
|
||||
use IceFox\Aspect\AspectContext;
|
||||
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class BasicAspect
|
||||
{
|
||||
public ?object $object = null;
|
||||
|
||||
public function before(object|string $target, mixed ...$args): void
|
||||
public function __construct(
|
||||
private readonly AspectContext $context,
|
||||
) {
|
||||
}
|
||||
|
||||
public function before(mixed ...$args): void
|
||||
{
|
||||
$this->object = end($args);
|
||||
$this->object->before = true;
|
||||
}
|
||||
|
||||
public function after(object|string $target, mixed $return): mixed
|
||||
public function after(mixed $return): mixed
|
||||
{
|
||||
$this->object->after = true;
|
||||
return $return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue