| Total Complexity | 4 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | /** |
||
| 15 | * Interceptor for cache refresh commands with #[Purge] or #[Refresh] |
||
| 16 | * |
||
| 17 | * Bound to methods marked with #[Purge] or #[Refresh] on non-Cacheable classes. |
||
| 18 | * Executes cache invalidation commands after successful method execution. |
||
| 19 | * |
||
| 20 | 2 | * @see \BEAR\RepositoryModule\Annotation\Purge |
|
| 21 | * @see \BEAR\RepositoryModule\Annotation\Refresh |
||
| 22 | 2 | * @see https://bearsunday.github.io/manuals/1.0/en/cache.html#event-driven-content |
|
| 23 | 2 | */ |
|
| 24 | final readonly class RefreshInterceptor implements MethodInterceptor |
||
|
|
|||
| 25 | 2 | { |
|
| 26 | public function __construct( |
||
| 27 | 2 | private RefreshAnnotatedCommand $command, |
|
| 28 | 2 | ) { |
|
| 29 | } |
||
| 30 | |||
| 31 | #[Override] |
||
| 32 | 2 | public function invoke(MethodInvocation $invocation): ResourceObject |
|
| 33 | 2 | { |
|
| 34 | /** @psalm-suppress MixedAssignment */ |
||
| 35 | $ro = $invocation->proceed(); |
||
| 47 |