@@ 65-71 (lines=7) @@ | ||
62 | * |
|
63 | * @return ObjectEnsurance |
|
64 | */ |
|
65 | public function isInstanceOf($class): ObjectEnsurance |
|
66 | { |
|
67 | $class = is_object($class) ? get_class($class) : $class; |
|
68 | $this->enforce($this->object instanceof $class)->orThrow('"%s" is not an instance of "%s"', get_class($this->object), $class); |
|
69 | ||
70 | return $this; |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * @param $class |
|
@@ 78-84 (lines=7) @@ | ||
75 | * |
|
76 | * @return ObjectEnsurance |
|
77 | */ |
|
78 | public function isNotInstanceOf($class): ObjectEnsurance |
|
79 | { |
|
80 | $class = is_object($class) ? get_class($class) : $class; |
|
81 | $this->enforce(!($this->object instanceof $class))->orThrow('"%s" is an instance of "%s"', get_class($this->object), $class); |
|
82 | ||
83 | return $this; |
|
84 | } |
|
85 | } |