NameNotFoundException::__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 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
namespace Apie\ObjectAccessNormalizer\Exceptions;
3
4
/**
5
 * Error thrown if a property name could not be found or has no methods or properties.
6
 */
7
class NameNotFoundException extends ApieException implements LocalizationableException
8
{
9
    private $name;
10
11
    public function __construct(string $name)
12
    {
13
        $this->name = $name;
14
        parent::__construct(500, 'Name "' . $name . '" not found!"');
15
    }
16
17
    public function getI18n(): LocalizationInfo
18
    {
19
        return new LocalizationInfo(
20
            'general.name_not_found',
21
            ['name' => $this->name]
22
        );
23
    }
24
}
25