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

ObjectExpectations::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
rs 9.4285
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
}