src/Factories/FormatterFactory.php 1 location
|
@@ 49-55 (lines=7) @@
|
| 46 |
|
* |
| 47 |
|
* @throws \InvalidArgumentException |
| 48 |
|
*/ |
| 49 |
|
private function validateFormatter(string $formatterClass): void |
| 50 |
|
{ |
| 51 |
|
$formatterInterface = FormatterInterface::class; |
| 52 |
|
if (! (new \ReflectionClass($formatterClass))->implementsInterface($formatterInterface)) { |
| 53 |
|
throw new \InvalidArgumentException("{$formatterClass} doesn't implement {$formatterInterface}"); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
|
src/Factories/HandlerFactory.php 1 location
|
@@ 69-75 (lines=7) @@
|
| 66 |
|
* |
| 67 |
|
* @throws \InvalidArgumentException |
| 68 |
|
*/ |
| 69 |
|
private function validateHandler(string $handlerClass): void |
| 70 |
|
{ |
| 71 |
|
$handlerInterface = HandlerInterface::class; |
| 72 |
|
if (! (new \ReflectionClass($handlerClass))->implementsInterface($handlerInterface)) { |
| 73 |
|
throw new \InvalidArgumentException("{$handlerClass} doesn't implement {$handlerInterface}"); |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
|
} |
| 77 |
|
|