| Conditions | 3 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function setStatus($state) |
||
| 32 | { |
||
| 33 | /** @noinspection PhpUndefinedClassConstantInspection */ |
||
| 34 | $statusClass = static::STATUS_ENTITY_CLASS; |
||
| 35 | |||
| 36 | if (is_string($state)) { |
||
| 37 | $state = new $statusClass($state); |
||
| 38 | } |
||
| 39 | |||
| 40 | if (!$state instanceOf $statusClass) { |
||
| 41 | throw new \InvalidArgumentException(sprintf( |
||
| 42 | 'Expected object of type %s, but recieved %s instead.', |
||
| 43 | $statusClass, get_class($state) |
||
| 44 | )); |
||
| 45 | } |
||
| 46 | |||
| 47 | $this->status = $state; |
||
| 48 | |||
| 49 | return $this; |
||
| 50 | } |
||
| 51 | |||
| 68 | } |