EntityNotFoundException::translate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php declare(strict_types=1);
2
3
namespace Audiens\AdForm\Exception;
4
5
/**
6
 * Exception thrown if an entity load returns an error
7
 */
8
class EntityNotFoundException extends SeverityAwareException
9
{
10
    protected const MESSAGE = 'Entity ID %d not found with message: %s';
11
12
    public static function translate($entityId, $message, $code): self
13
    {
14
        return new self (
15
            sprintf(self::MESSAGE, $entityId, $message),
16
            $code,
17
            null,
18
            SeverityAwareException::SEVERITY_ERROR
19
        );
20
    }
21
}
22