Test Failed
Push — master ( 72a6c5...9329b7 )
by Arun
03:52
created

TypeMatcher::matches()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace DeepCopy\TypeMatcher;
4
5
/**
6
 * TypeMatcher class
7
 */
8
class TypeMatcher
9
{
10
    /**
11
     * @var string
12
     */
13
    private $type;
14
15
    /**
16
     * @param string $type
17
     */
18
    public function __construct($type)
19
    {
20
        $this->type = $type;
21
    }
22
23
    /**
24
     * @param $element
25
     * @return boolean
26
     */
27
    public function matches($element)
28
    {
29
        return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type;
30
    }
31
}
32