IllegalPropertyTypeException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 31
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <[email protected]>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Exception;
16
17
use \Exception;
18
19
/**
20
 * Throw when attempting to set the value of a property using an
21
 * unacceptable property type
22
 */
23
class IllegalPropertyTypeException extends Exception
24
{
25
    /**
26
     * Creates the exception, populating its error message from class
27
     * and property names, the expected type and the type that was given
28
     *
29
     * @param string $class The classname accessed
30
     * @param string $property The property accessed
31
     * @param string $expected The expected type
32
     * @param string $got The type that was provided
33
     * @param Exception $previous The exception which caused this
34
     */
35 1
    public function __construct
36
    (
37
        string $class,
38
        string $property,
39
        string $expected,
40
        string $got,
41
        Exception $previous = null
42
    )
43
    {
44 1
        parent::__construct
45
        (
46
              'Tried to set an illegal property type for '
47 1
            . $class .'::$' . $property . '. Excpected ' . $expected
48 1
            . ', got ' . $got,
49 1
            0,
50 1
            $previous
51
        );
52 1
    }
53
}
54