Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| AuditMethodCalled | |
0.00% |
0 / 9 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getContents | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getDescription | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\Common\Other\Audit; |
| 3 | |
| 4 | use Apie\Common\Enums\AuditLogEvent; |
| 5 | use Apie\Core\Context\ApieContext; |
| 6 | use Apie\Core\Entities\EntityInterface; |
| 7 | use Apie\Core\Translator\ApieTranslatorInterface; |
| 8 | use Apie\Core\Translator\ValueObjects\TranslationString; |
| 9 | use Apie\Core\ValueObjects\NonEmptyString; |
| 10 | |
| 11 | class AuditMethodCalled implements AuditEvent |
| 12 | { |
| 13 | public function __construct( |
| 14 | private string $methodName, |
| 15 | private mixed $contents |
| 16 | ) { |
| 17 | } |
| 18 | public function getEvent(): AuditLogEvent |
| 19 | { |
| 20 | return AuditLogEvent::MethodCalled; |
| 21 | } |
| 22 | |
| 23 | public function getContents(): mixed |
| 24 | { |
| 25 | return $this->contents; |
| 26 | } |
| 27 | |
| 28 | public function getDescription( |
| 29 | ApieTranslatorInterface $translator, |
| 30 | ApieContext $context, |
| 31 | string|EntityInterface|null $entity, |
| 32 | ): NonEmptyString { |
| 33 | return NonEmptyString::fromNative( |
| 34 | $translator->getGeneralTranslation( |
| 35 | $context, |
| 36 | new TranslationString('audit_log.method_called.' . $this->methodName) |
| 37 | ) |
| 38 | ); |
| 39 | } |
| 40 | } |