.
This commit is contained in:
commit
a5ce423afe
30 changed files with 1807 additions and 0 deletions
27
tests/Aspects/LoggingAspect.php
Normal file
27
tests/Aspects/LoggingAspect.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Aspects;
|
||||
|
||||
use Attribute;
|
||||
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class LoggingAspect
|
||||
{
|
||||
public static array $logs = [];
|
||||
|
||||
public function before(object|string $target, mixed ...$args): void
|
||||
{
|
||||
self::$logs[] = ['type' => 'logging_before', 'args' => $args];
|
||||
}
|
||||
|
||||
public function after(object|string $target, mixed $result): mixed
|
||||
{
|
||||
self::$logs[] = ['type' => 'logging_after', 'result' => $result];
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function clearLogs(): void
|
||||
{
|
||||
self::$logs = [];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue