NameNotFoundException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getI18n() 0 5 1
A __construct() 0 4 1
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