diff --git a/composer.json b/composer.json index 99dd750..c7ad529 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "werk365/identitydocuments", "description": "Package to parse identity documents like passports", "license": "GPL-3.0-or-later", - "version": "2.0.1", + "version": "2.0.2", "authors": [ { "name": "Hergen Dillema", diff --git a/src/Commands/MakeService.php b/src/Commands/MakeService.php index fd51d02..a667bd5 100644 --- a/src/Commands/MakeService.php +++ b/src/Commands/MakeService.php @@ -50,8 +50,14 @@ public function handle() case 'facedetection': case 'fd': $this->stubName = 'FaceDetectionServiceStub.php'; + break; case 'both': $this->stubName = 'OcrFdServiceStub.php'; + break; + default: + $this->error('Service Type not recognized, try using "OCR", "FaceDetection" or "Both"'); + + return false; } // First we need to ensure that the given name is not a reserved word within the PHP // language and that the class name will actually be valid. If it is not valid we diff --git a/src/Exceptions/CouldNotSetService.php b/src/Exceptions/CouldNotSetService.php new file mode 100644 index 0000000..2a8810c --- /dev/null +++ b/src/Exceptions/CouldNotSetService.php @@ -0,0 +1,13 @@ +implementsInterface(OCR::class)) { - dd('not ocr'); + throw CouldNotSetService::couldNotDetectInterface(OCR::class, $service); } $this->ocrService = $service; } @@ -38,7 +39,7 @@ public function setFaceDetectionService(string $service) { $class = new ReflectionClass($service); if (! $class->implementsInterface(FaceDetection::class)) { - dd('not fd'); + throw CouldNotSetService::couldNotDetectInterface(FaceDetection::class, $service); } $this->faceDetectionService = $service; }