Passed
Pull Request — 2.2 (#1855)
by Baptiste
03:59 queued 01:15
created

InvalidValueException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReason() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\Exception;
15
16
class InvalidValueException extends InvalidArgumentException
17
{
18
    private $reason;
19
20
    public function __construct(string $reason, int $code = 0, \Throwable $previous = null)
21
    {
22
        $this->reason = $reason;
23
24
        parent::__construct("Invalid value provided ({$reason}).", $code, $previous);
25
    }
26
27
    public function getReason(): string
28
    {
29
        return $this->reason;
30
    }
31
}
32