35 lines
687 B
PHP
35 lines
687 B
PHP
<?php
|
|
|
|
namespace Tests\Aspects;
|
|
|
|
use Attribute;
|
|
use IceFox\Aspect\AspectContext;
|
|
|
|
#[Attribute(Attribute::TARGET_METHOD)]
|
|
class ParameterKeyAspect
|
|
{
|
|
public static array $capturedKeys = [];
|
|
public static array $capturedArgs = [];
|
|
|
|
public function __construct(
|
|
private readonly AspectContext $context,
|
|
) {
|
|
}
|
|
|
|
public function before(array $args): void
|
|
{
|
|
self::$capturedKeys = array_keys($args);
|
|
self::$capturedArgs = $args;
|
|
}
|
|
|
|
public function after(mixed $result): mixed
|
|
{
|
|
return $result;
|
|
}
|
|
|
|
public static function reset(): void
|
|
{
|
|
self::$capturedKeys = [];
|
|
self::$capturedArgs = [];
|
|
}
|
|
}
|