Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
12.50% covered (danger)
12.50%
1 / 8
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
AuditMigration
12.50% covered (danger)
12.50%
1 / 8
50.00% covered (danger)
50.00%
1 / 2
4.68
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 / 7
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\AuditLogEventMessage;
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        return NonEmptyString::fromNative(
26            $translator->getGeneralTranslation(
27                $context,
28                AuditLogEventMessage::createMigrationEvent($context)
29            )
30        );
31    }
32}