Completed
Pull Request — master (#1167)
by Nik
10:38
created

NonCastableTypeException::getValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Exception;
6
7
class NonCastableTypeException extends RuntimeException
8
{
9
    /**
10
     * @var mixed
11
     */
12
    private $value;
13
14
    /**
15
     * @param mixed $value
16
     */
17
    public function __construct(string $expectedType, $value)
18
    {
19
        $this->value = $value;
20
21
        parent::__construct(
22
            sprintf(
23
                'Cannot convert value of type "%s" to %s',
24
                gettype($value),
25
                $expectedType
26
            )
27
        );
28
    }
29
30
    /**
31
     * @return mixed
32
     */
33
    public function getValue()
34
    {
35
        return $this->value;
36
    }
37
}
38