ClassName::itFits()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Isolate\LazyObjects\Proxy;
4
5
use Isolate\LazyObjects\Exception\InvalidArgumentException;
6
7
/**
8
 * @api
9
 */
10
class ClassName
11
{
12
    /**
13
     * @var string
14
     */
15
    private $className;
16
17
    /**
18
     * @param string $className
19
     * @throws InvalidArgumentException
20
     */
21
    public function __construct($className)
22
    {
23
        if (!class_exists($className)) {
24
            throw new InvalidArgumentException(sprintf("Class \"%s\" does not exists.", $className));
25
        }
26
27
        $this->className = $className;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function __toString()
34
    {
35
        return $this->className;
36
    }
37
38
    /**
39
     * @param $object
40
     * @return bool
41
     * 
42
     * @api
43
     */
44
    public function itFits($object)
45
    {
46
        return is_a($object, $this->className);
47
    }
48
}
49