Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
10.00% |
1 / 10 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| AuditRemoved | |
10.00% |
1 / 10 |
|
50.00% |
1 / 2 |
4.92 | |
0.00% |
0 / 1 |
| getEvent | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDescription | |
0.00% |
0 / 9 |
|
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 AuditRemoved implements AuditEvent |
| 12 | { |
| 13 | public function getEvent(): AuditLogEvent |
| 14 | { |
| 15 | return AuditLogEvent::Removed; |
| 16 | } |
| 17 | |
| 18 | public function getDescription( |
| 19 | ApieTranslatorInterface $translator, |
| 20 | ApieContext $context, |
| 21 | string|EntityInterface|null $entity, |
| 22 | ): NonEmptyString { |
| 23 | |
| 24 | $refl = new \ReflectionClass($entity); |
| 25 | return NonEmptyString::fromNative( |
| 26 | $translator->getGeneralTranslation( |
| 27 | $context, |
| 28 | new TranslationString( |
| 29 | 'audit_log.removed.' . $refl->getShortName() |
| 30 | ) |
| 31 | ) |
| 32 | ); |
| 33 | } |
| 34 | } |