| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function makeSearchableObject($className) |
||
| 44 | { |
||
| 45 | if (! (new \ReflectionClass($className))->implementsInterface(SearchableInterface::class)) { |
||
| 46 | throw new \InvalidArgumentException("Cannot initiate a class ({$className}) which doesn't implement leinonen\\Yii2Algolia\\SearchableInterface"); |
||
| 47 | } |
||
| 48 | |||
| 49 | return new $className(); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |