Passed
Push — master ( 65d8ad...c74ce3 )
by Pieter
04:45 queued 14s
created

InvalidIdException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getI18n() 0 6 1
A __construct() 0 4 1
1
<?php
2
namespace W2w\Lib\Apie\Exceptions;
3
4
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationableException;
5
use W2w\Lib\ApieObjectAccessNormalizer\Exceptions\LocalizationInfo;
6
7
class InvalidIdException extends ApieException implements LocalizationableException
0 ignored issues
show
Deprecated Code introduced by
The class W2w\Lib\Apie\Exceptions\ApieException has been deprecated: use \W2w\Lib\ApieObjectAccessNormalizer\Exceptions\ApieException ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

7
class InvalidIdException extends /** @scrutinizer ignore-deprecated */ ApieException implements LocalizationableException
Loading history...
8
{
9
    private $id;
10
11
    public function __construct(string $id)
12
    {
13
        $this->id = $id;
14
        parent::__construct(500, 'Id "' . $id . '" is not valid as identifier');
15
    }
16
17
    public function getI18n(): LocalizationInfo
18
    {
19
        return new LocalizationInfo(
20
            'validation.id',
21
            [
22
                'id' => $this->id
23
            ]
24
        );
25
    }
26
}
27