Completed
Push — master ( a72876...48a801 )
by Changwan
04:53
created

CannotInjectException::getClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Wandu\DI\Exception;
3
4
use Interop\Container\Exception\ContainerException;
5
use Psr\Container\ContainerExceptionInterface;
6
use RuntimeException;
7
8
class CannotInjectException extends RuntimeException implements ContainerExceptionInterface, ContainerException 
9
{
10
    /** @var string */
11
    protected $class;
12
13
    /** @var string */
14
    protected $property;
15
    
16
    /**
17
     * @param string $class
18
     * @param string $property
19
     */
20
    public function __construct($class, $property)
21
    {
22
        $this->class = $class;
23
        $this->property = $property;
24
        $this->message = "It cannot be injected; {$class}::\${$property}";
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getClass(): string
31
    {
32
        return $this->class;
33
    }
34
    
35
    /**
36
     * @return string
37
     */
38
    public function getProperty()
39
    {
40
        return $this->property;
41
    }
42
}
43