Completed
Push — master ( 9d6b90...0a141c )
by Randy
11:08
created

ObjectExpectations::isInstanceOf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Dgame\Expectation;
4
5
/**
6
 * Class ObjectExpectations
7
 * @package Dgame\Expectation
8
 */
9
final class ObjectExpectations
10
{
11
    use ConditionTrait;
12
13
    /**
14
     * ObjectExpectations constructor.
15
     *
16
     * @param $value
17
     */
18
    public function __construct($value)
19
    {
20
        if ($this->approveIf(is_object($value))->isApproved()) {
21
            $this->value = $value;
22
        }
23
    }
24
25
    /**
26
     * @param $object
27
     *
28
     * @return ObjectExpectations
29
     */
30
    public function isInstanceOf($object): self
31
    {
32
        return $this->approveIf($this->value instanceof $object);
33
    }
34
}