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

ObjectExpectations   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A isInstanceOf() 0 4 1
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
}