Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
11.11% covered (danger)
11.11%
1 / 9
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
AuditMigration
11.11% covered (danger)
11.11%
1 / 9
50.00% covered (danger)
50.00%
1 / 2
4.81
0.00% covered (danger)
0.00%
0 / 1
 getEvent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDescription
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2namespace Apie\Common\Other\Audit;
3
4use Apie\Common\Enums\AuditLogEvent;
5use Apie\Core\Context\ApieContext;
6use Apie\Core\Entities\EntityInterface;
7use Apie\Core\Translator\ApieTranslatorInterface;
8use Apie\Core\Translator\ValueObjects\TranslationString;
9use Apie\Core\ValueObjects\NonEmptyString;
10
11class AuditMigration implements AuditEvent
12{
13
14    public function getEvent(): AuditLogEvent
15    {
16        return AuditLogEvent::Migration;
17    }
18
19    public function getDescription(
20        ApieTranslatorInterface $translator,
21        ApieContext $context,
22        string|EntityInterface|null $entity,
23    ): NonEmptyString {
24        assert(is_string($entity));
25        $refl = new \ReflectionClass($entity);
26        return NonEmptyString::fromNative(
27            $translator->getGeneralTranslation(
28                $context,
29                new TranslationString('audit_log.migration.' . $refl->getShortName())
30            )
31        );
32    }
33}