InvalidIdException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
namespace Apie\FileStoragePlugin\Exceptions;
3
4
use Apie\Core\Exceptions\ApieException;
5
use Apie\Core\Exceptions\LocalizationableException;
6
use Apie\Core\Exceptions\LocalizationInfo;
7
8
class InvalidIdException extends ApieException implements LocalizationableException
9
{
10
    private $id;
11
12
    public function __construct(string $id)
13
    {
14
        $this->id = $id;
15
        parent::__construct(500, 'Id "' . $id . '" is not valid as identifier');
16
    }
17
18
    public function getI18n(): LocalizationInfo
19
    {
20
        return new LocalizationInfo(
21
            'validation.id',
22
            [
23
                'id' => $this->id
24
            ]
25
        );
26
    }
27
}
28