| Conditions | 4 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | 2 | public function hasSubject(): bool |
|
| 31 | { |
||
| 32 | if (!is_object($this->subject)) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | $hasInterface = $this->subject instanceof HasMedia; |
||
| 36 | if ($hasInterface) { |
||
| 37 | return true; |
||
| 38 | 3 | } |
|
| 39 | if (Oop::classUsesTrait($this->subject, HasMediaTrait::class)) { |
||
| 40 | 3 | throw new RuntimeException("Class " . get_class($this->subject) . " does not have the HasMedia interface"); |
|
| 41 | } |
||
| 42 | 3 | return false; |
|
| 43 | } |
||
| 57 |