From acd3e8ad03490f8fca469b7df4082ab83a1022cf Mon Sep 17 00:00:00 2001 From: sebastianMindee <130448732+sebastianMindee@users.noreply.github.com> Date: Thu, 28 May 2026 11:24:06 +0200 Subject: [PATCH] :coffin: remove support for unused V1 products --- bin/MindeeCliDocuments.php | 63 ---- docs/code_samples/bill_of_lading_v1_async.txt | 16 - docs/code_samples/delivery_notes_v1_async.txt | 16 - .../code_samples/energy_bill_fra_v1_async.txt | 16 - .../french_healthcard_v1_async.txt | 16 - docs/code_samples/ind_passport_v1_async.txt | 16 - .../code_samples/nutrition_facts_v1_async.txt | 16 - docs/code_samples/payslip_fra_v3_async.txt | 16 - .../us_healthcare_cards_v1_async.txt | 16 - docs/code_samples/us_mail_v3_async.txt | 16 - .../Product/BillOfLading/BillOfLadingV1.php | 42 --- .../BillOfLading/BillOfLadingV1Carrier.php | 79 ----- .../BillOfLadingV1CarrierItem.php | 104 ------ .../BillOfLadingV1CarrierItems.php | 74 ----- .../BillOfLading/BillOfLadingV1Consignee.php | 85 ----- .../BillOfLading/BillOfLadingV1Document.php | 173 ---------- .../BillOfLadingV1NotifyParty.php | 86 ----- .../BillOfLading/BillOfLadingV1Shipper.php | 86 ----- .../Product/DeliveryNote/DeliveryNoteV1.php | 42 --- .../DeliveryNote/DeliveryNoteV1Document.php | 121 ------- src/V1/Product/Fr/EnergyBill/EnergyBillV1.php | 42 --- .../Fr/EnergyBill/EnergyBillV1Document.php | 212 ------------ .../EnergyBill/EnergyBillV1EnergyConsumer.php | 72 ---- .../EnergyBill/EnergyBillV1EnergySupplier.php | 72 ---- .../Fr/EnergyBill/EnergyBillV1EnergyUsage.php | 119 ------- .../EnergyBill/EnergyBillV1EnergyUsages.php | 78 ----- .../Fr/EnergyBill/EnergyBillV1MeterDetail.php | 79 ----- .../EnergyBill/EnergyBillV1Subscription.php | 104 ------ .../EnergyBill/EnergyBillV1Subscriptions.php | 74 ----- .../EnergyBillV1TaxesAndContribution.php | 104 ------ .../EnergyBillV1TaxesAndContributions.php | 74 ----- src/V1/Product/Fr/HealthCard/HealthCardV1.php | 42 --- .../Fr/HealthCard/HealthCardV1Document.php | 88 ----- src/V1/Product/Fr/Payslip/PayslipV3.php | 42 --- .../Fr/Payslip/PayslipV3BankAccountDetail.php | 79 ----- .../Product/Fr/Payslip/PayslipV3Document.php | 138 -------- .../Product/Fr/Payslip/PayslipV3Employee.php | 107 ------ .../Product/Fr/Payslip/PayslipV3Employer.php | 107 ------ .../Fr/Payslip/PayslipV3Employment.php | 107 ------ .../Fr/Payslip/PayslipV3PaidTimeOff.php | 97 ------ .../Fr/Payslip/PayslipV3PaidTimeOffs.php | 72 ---- .../Product/Fr/Payslip/PayslipV3PayDetail.php | 138 -------- .../Product/Fr/Payslip/PayslipV3PayPeriod.php | 93 ------ .../Fr/Payslip/PayslipV3SalaryDetail.php | 98 ------ .../Fr/Payslip/PayslipV3SalaryDetails.php | 72 ---- .../Ind/IndianPassport/IndianPassportV1.php | 42 --- .../IndianPassportV1Document.php | 313 ------------------ .../NutritionFactsLabelV1.php | 42 --- .../NutritionFactsLabelV1AddedSugar.php | 82 ----- .../NutritionFactsLabelV1Calorie.php | 82 ----- .../NutritionFactsLabelV1Cholesterol.php | 82 ----- .../NutritionFactsLabelV1DietaryFiber.php | 82 ----- .../NutritionFactsLabelV1Document.php | 216 ------------ .../NutritionFactsLabelV1Nutrient.php | 97 ------ .../NutritionFactsLabelV1Nutrients.php | 72 ---- .../NutritionFactsLabelV1Protein.php | 82 ----- .../NutritionFactsLabelV1SaturatedFat.php | 82 ----- .../NutritionFactsLabelV1ServingSize.php | 73 ---- .../NutritionFactsLabelV1Sodium.php | 89 ----- ...NutritionFactsLabelV1TotalCarbohydrate.php | 82 ----- .../NutritionFactsLabelV1TotalFat.php | 82 ----- .../NutritionFactsLabelV1TotalSugar.php | 83 ----- .../NutritionFactsLabelV1TransFat.php | 82 ----- .../Us/HealthcareCard/HealthcareCardV1.php | 42 --- .../HealthcareCard/HealthcareCardV1Copay.php | 74 ----- .../HealthcareCard/HealthcareCardV1Copays.php | 66 ---- .../HealthcareCardV1Document.php | 209 ------------ src/V1/Product/Us/UsMail/UsMailV3.php | 42 --- src/V1/Product/Us/UsMail/UsMailV3Document.php | 102 ------ .../Us/UsMail/UsMailV3RecipientAddress.php | 115 ------- .../Us/UsMail/UsMailV3RecipientAddresses.php | 78 ----- .../Us/UsMail/UsMailV3SenderAddress.php | 93 ------ .../BillOfLading/BillOfLadingV1Test.php | 61 ---- .../DeliveryNote/DeliveryNoteV1Test.php | 46 --- .../Fr/EnergyBill/EnergyBillV1Test.php | 57 ---- .../Fr/HealthCard/HealthCardV1Test.php | 43 --- tests/V1/Product/Fr/Payslip/PayslipV3Test.php | 80 ----- .../IndianPassport/IndianPassportV1Test.php | 60 ---- .../NutritionFactsLabelV1Test.php | 77 ----- .../HealthcareCard/HealthcareCardV1Test.php | 53 --- tests/V1/Product/Us/UsMail/UsMailV3Test.php | 48 --- 81 files changed, 6520 deletions(-) delete mode 100644 docs/code_samples/bill_of_lading_v1_async.txt delete mode 100644 docs/code_samples/delivery_notes_v1_async.txt delete mode 100644 docs/code_samples/energy_bill_fra_v1_async.txt delete mode 100644 docs/code_samples/french_healthcard_v1_async.txt delete mode 100644 docs/code_samples/ind_passport_v1_async.txt delete mode 100644 docs/code_samples/nutrition_facts_v1_async.txt delete mode 100644 docs/code_samples/payslip_fra_v3_async.txt delete mode 100644 docs/code_samples/us_healthcare_cards_v1_async.txt delete mode 100644 docs/code_samples/us_mail_v3_async.txt delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1Carrier.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1CarrierItem.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1CarrierItems.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1Consignee.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1Document.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1NotifyParty.php delete mode 100644 src/V1/Product/BillOfLading/BillOfLadingV1Shipper.php delete mode 100644 src/V1/Product/DeliveryNote/DeliveryNoteV1.php delete mode 100644 src/V1/Product/DeliveryNote/DeliveryNoteV1Document.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1Document.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyConsumer.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergySupplier.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsage.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsages.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1MeterDetail.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscription.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscriptions.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContribution.php delete mode 100644 src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContributions.php delete mode 100644 src/V1/Product/Fr/HealthCard/HealthCardV1.php delete mode 100644 src/V1/Product/Fr/HealthCard/HealthCardV1Document.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3BankAccountDetail.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3Document.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3Employee.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3Employer.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3Employment.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOff.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOffs.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3PayDetail.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3PayPeriod.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3SalaryDetail.php delete mode 100644 src/V1/Product/Fr/Payslip/PayslipV3SalaryDetails.php delete mode 100644 src/V1/Product/Ind/IndianPassport/IndianPassportV1.php delete mode 100644 src/V1/Product/Ind/IndianPassport/IndianPassportV1Document.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1AddedSugar.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Calorie.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Cholesterol.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1DietaryFiber.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Document.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrient.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrients.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Protein.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1SaturatedFat.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1ServingSize.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Sodium.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalCarbohydrate.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalFat.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalSugar.php delete mode 100644 src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TransFat.php delete mode 100644 src/V1/Product/Us/HealthcareCard/HealthcareCardV1.php delete mode 100644 src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copay.php delete mode 100644 src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copays.php delete mode 100644 src/V1/Product/Us/HealthcareCard/HealthcareCardV1Document.php delete mode 100644 src/V1/Product/Us/UsMail/UsMailV3.php delete mode 100644 src/V1/Product/Us/UsMail/UsMailV3Document.php delete mode 100644 src/V1/Product/Us/UsMail/UsMailV3RecipientAddress.php delete mode 100644 src/V1/Product/Us/UsMail/UsMailV3RecipientAddresses.php delete mode 100644 src/V1/Product/Us/UsMail/UsMailV3SenderAddress.php delete mode 100644 tests/V1/Product/BillOfLading/BillOfLadingV1Test.php delete mode 100644 tests/V1/Product/DeliveryNote/DeliveryNoteV1Test.php delete mode 100644 tests/V1/Product/Fr/EnergyBill/EnergyBillV1Test.php delete mode 100644 tests/V1/Product/Fr/HealthCard/HealthCardV1Test.php delete mode 100644 tests/V1/Product/Fr/Payslip/PayslipV3Test.php delete mode 100644 tests/V1/Product/Ind/IndianPassport/IndianPassportV1Test.php delete mode 100644 tests/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Test.php delete mode 100644 tests/V1/Product/Us/HealthcareCard/HealthcareCardV1Test.php delete mode 100644 tests/V1/Product/Us/UsMail/UsMailV3Test.php diff --git a/bin/MindeeCliDocuments.php b/bin/MindeeCliDocuments.php index 20d72da3..08550a2c 100644 --- a/bin/MindeeCliDocuments.php +++ b/bin/MindeeCliDocuments.php @@ -5,31 +5,22 @@ namespace Mindee\Cli; use Mindee\V1\Product\BarcodeReader\BarcodeReaderV1; -use Mindee\V1\Product\BillOfLading\BillOfLadingV1; use Mindee\V1\Product\BusinessCard\BusinessCardV1; use Mindee\V1\Product\Cropper\CropperV1; -use Mindee\V1\Product\DeliveryNote\DeliveryNoteV1; use Mindee\V1\Product\DriverLicense\DriverLicenseV1; use Mindee\V1\Product\FinancialDocument\FinancialDocumentV1; use Mindee\V1\Product\Fr\BankAccountDetails\BankAccountDetailsV2; use Mindee\V1\Product\Fr\CarteGrise\CarteGriseV1; -use Mindee\V1\Product\Fr\EnergyBill\EnergyBillV1; -use Mindee\V1\Product\Fr\HealthCard\HealthCardV1; use Mindee\V1\Product\Fr\IdCard\IdCardV2; -use Mindee\V1\Product\Fr\Payslip\PayslipV3; use Mindee\V1\Product\Generated\GeneratedV1; -use Mindee\V1\Product\Ind\IndianPassport\IndianPassportV1; use Mindee\V1\Product\InternationalId\InternationalIdV2; use Mindee\V1\Product\Invoice\InvoiceV4; use Mindee\V1\Product\InvoiceSplitter\InvoiceSplitterV1; use Mindee\V1\Product\MultiReceiptsDetector\MultiReceiptsDetectorV1; -use Mindee\V1\Product\NutritionFactsLabel\NutritionFactsLabelV1; use Mindee\V1\Product\Passport\PassportV1; use Mindee\V1\Product\Receipt\ReceiptV5; use Mindee\V1\Product\Resume\ResumeV1; use Mindee\V1\Product\Us\BankCheck\BankCheckV1; -use Mindee\V1\Product\Us\HealthcareCard\HealthcareCardV1; -use Mindee\V1\Product\Us\UsMail\UsMailV3; /** * Document specifications for CLI usage. @@ -55,12 +46,6 @@ public static function getSpecs(): array true, false ), - "bill-of-lading" => new DocumentCommandConfig( - "Bill of Lading", - BillOfLadingV1::class, - false, - true - ), "business-card" => new DocumentCommandConfig( "Business Card", BusinessCardV1::class, @@ -73,12 +58,6 @@ public static function getSpecs(): array true, false ), - "delivery-note" => new DocumentCommandConfig( - "Delivery note", - DeliveryNoteV1::class, - false, - true - ), "driver-license" => new DocumentCommandConfig( "Driver License", DriverLicenseV1::class, @@ -103,36 +82,12 @@ public static function getSpecs(): array true, false ), - "fr-energy-bill" => new DocumentCommandConfig( - "FR Energy Bill", - EnergyBillV1::class, - false, - true - ), - "fr-health-card" => new DocumentCommandConfig( - "FR Health Card", - HealthCardV1::class, - false, - true - ), "fr-carte-nationale-d-identite" => new DocumentCommandConfig( "FR Carte Nationale d'Identité", IdCardV2::class, true, false ), - "fr-payslip" => new DocumentCommandConfig( - "FR Payslip", - PayslipV3::class, - false, - true - ), - "ind-passport-india" => new DocumentCommandConfig( - "IND Passport - India", - IndianPassportV1::class, - false, - true - ), "international-id" => new DocumentCommandConfig( "International ID", InternationalIdV2::class, @@ -157,12 +112,6 @@ public static function getSpecs(): array true, false ), - "nutrition-facts-label" => new DocumentCommandConfig( - "Nutrition Facts Label", - NutritionFactsLabelV1::class, - false, - true - ), "passport" => new DocumentCommandConfig( "Passport", PassportV1::class, @@ -187,18 +136,6 @@ public static function getSpecs(): array true, false ), - "us-healthcare-card" => new DocumentCommandConfig( - "US Healthcare Card", - HealthcareCardV1::class, - false, - true - ), - "us-us-mail" => new DocumentCommandConfig( - "US US Mail", - UsMailV3::class, - false, - true - ), ]; } } diff --git a/docs/code_samples/bill_of_lading_v1_async.txt b/docs/code_samples/bill_of_lading_v1_async.txt deleted file mode 100644 index b277246d..00000000 --- a/docs/code_samples/bill_of_lading_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(BillOfLadingV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/delivery_notes_v1_async.txt b/docs/code_samples/delivery_notes_v1_async.txt deleted file mode 100644 index d6716398..00000000 --- a/docs/code_samples/delivery_notes_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(DeliveryNoteV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/energy_bill_fra_v1_async.txt b/docs/code_samples/energy_bill_fra_v1_async.txt deleted file mode 100644 index 35d624a6..00000000 --- a/docs/code_samples/energy_bill_fra_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(EnergyBillV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/french_healthcard_v1_async.txt b/docs/code_samples/french_healthcard_v1_async.txt deleted file mode 100644 index 1ee85173..00000000 --- a/docs/code_samples/french_healthcard_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(HealthCardV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/ind_passport_v1_async.txt b/docs/code_samples/ind_passport_v1_async.txt deleted file mode 100644 index 40523afe..00000000 --- a/docs/code_samples/ind_passport_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(IndianPassportV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/nutrition_facts_v1_async.txt b/docs/code_samples/nutrition_facts_v1_async.txt deleted file mode 100644 index 197344e8..00000000 --- a/docs/code_samples/nutrition_facts_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(NutritionFactsLabelV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/payslip_fra_v3_async.txt b/docs/code_samples/payslip_fra_v3_async.txt deleted file mode 100644 index d185d728..00000000 --- a/docs/code_samples/payslip_fra_v3_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(PayslipV3::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/us_healthcare_cards_v1_async.txt b/docs/code_samples/us_healthcare_cards_v1_async.txt deleted file mode 100644 index d0f21100..00000000 --- a/docs/code_samples/us_healthcare_cards_v1_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(HealthcareCardV1::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/docs/code_samples/us_mail_v3_async.txt b/docs/code_samples/us_mail_v3_async.txt deleted file mode 100644 index 442e74a3..00000000 --- a/docs/code_samples/us_mail_v3_async.txt +++ /dev/null @@ -1,16 +0,0 @@ -enqueueAndParse(UsMailV3::class, $inputSource); - -echo $apiResponse->document; \ No newline at end of file diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1.php b/src/V1/Product/BillOfLading/BillOfLadingV1.php deleted file mode 100644 index aadf37d8..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new BillOfLadingV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(BillOfLadingV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1Carrier.php b/src/V1/Product/BillOfLading/BillOfLadingV1Carrier.php deleted file mode 100644 index 59e75647..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1Carrier.php +++ /dev/null @@ -1,79 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->name = $rawPrediction["name"] ?? null; - $this->professionalNumber = $rawPrediction["professional_number"] ?? null; - $this->scac = $rawPrediction["scac"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - $outArr["professionalNumber"] = SummaryHelperV1::formatForDisplay($this->professionalNumber); - $outArr["scac"] = SummaryHelperV1::formatForDisplay($this->scac); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Name: " . $printable["name"]; - $outStr .= "\n :Professional Number: " . $printable["professionalNumber"]; - $outStr .= "\n :SCAC: " . $printable["scac"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItem.php b/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItem.php deleted file mode 100644 index 2df1d83a..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItem.php +++ /dev/null @@ -1,104 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->description = $rawPrediction["description"] ?? null; - $this->grossWeight = isset($rawPrediction["gross_weight"]) - ? (float) ($rawPrediction["gross_weight"]) : null; - $this->measurement = isset($rawPrediction["measurement"]) - ? (float) ($rawPrediction["measurement"]) : null; - $this->measurementUnit = $rawPrediction["measurement_unit"] ?? null; - $this->quantity = isset($rawPrediction["quantity"]) - ? (float) ($rawPrediction["quantity"]) : null; - $this->weightUnit = $rawPrediction["weight_unit"] ?? null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["description"] = SummaryHelperV1::formatForDisplay($this->description, 36); - $outArr["grossWeight"] = SummaryHelperV1::formatFloat($this->grossWeight); - $outArr["measurement"] = SummaryHelperV1::formatFloat($this->measurement); - $outArr["measurementUnit"] = SummaryHelperV1::formatForDisplay($this->measurementUnit); - $outArr["quantity"] = SummaryHelperV1::formatFloat($this->quantity); - $outArr["weightUnit"] = SummaryHelperV1::formatForDisplay($this->weightUnit); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["description"], 36); - $outStr .= SummaryHelperV1::padString($printable["grossWeight"], 12); - $outStr .= SummaryHelperV1::padString($printable["measurement"], 11); - $outStr .= SummaryHelperV1::padString($printable["measurementUnit"], 16); - $outStr .= SummaryHelperV1::padString($printable["quantity"], 8); - $outStr .= SummaryHelperV1::padString($printable["weightUnit"], 11); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItems.php b/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItems.php deleted file mode 100644 index 73d953af..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1CarrierItems.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ -class BillOfLadingV1CarrierItems extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new BillOfLadingV1CarrierItem($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function carrierItemsSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 38); - $outStr .= "+" . str_repeat($char, 14); - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 18); - $outStr .= "+" . str_repeat($char, 10); - $outStr .= "+" . str_repeat($char, 13); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::carrierItemsSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::carrierItemsSeparator('-') . "\n "; - $outStr .= " | Description "; - $outStr .= " | Gross Weight"; - $outStr .= " | Measurement"; - $outStr .= " | Measurement Unit"; - $outStr .= " | Quantity"; - $outStr .= " | Weight Unit"; - $outStr .= " |\n" . self::carrierItemsSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1Consignee.php b/src/V1/Product/BillOfLading/BillOfLadingV1Consignee.php deleted file mode 100644 index be1fa8ba..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1Consignee.php +++ /dev/null @@ -1,85 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->email = $rawPrediction["email"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - $this->phone = $rawPrediction["phone"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["email"] = SummaryHelperV1::formatForDisplay($this->email); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - $outArr["phone"] = SummaryHelperV1::formatForDisplay($this->phone); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Email: " . $printable["email"]; - $outStr .= "\n :Name: " . $printable["name"]; - $outStr .= "\n :Phone: " . $printable["phone"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1Document.php b/src/V1/Product/BillOfLading/BillOfLadingV1Document.php deleted file mode 100644 index 89cbed52..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1Document.php +++ /dev/null @@ -1,173 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["bill_of_lading_number"])) { - throw new MindeeUnsetException(); - } - $this->billOfLadingNumber = new StringField( - $rawPrediction["bill_of_lading_number"], - $pageId - ); - if (!isset($rawPrediction["carrier"])) { - throw new MindeeUnsetException(); - } - $this->carrier = new BillOfLadingV1Carrier( - $rawPrediction["carrier"], - $pageId - ); - if (!isset($rawPrediction["carrier_items"])) { - throw new MindeeUnsetException(); - } - $this->carrierItems = new BillOfLadingV1CarrierItems( - $rawPrediction["carrier_items"], - $pageId - ); - if (!isset($rawPrediction["consignee"])) { - throw new MindeeUnsetException(); - } - $this->consignee = new BillOfLadingV1Consignee( - $rawPrediction["consignee"], - $pageId - ); - if (!isset($rawPrediction["date_of_issue"])) { - throw new MindeeUnsetException(); - } - $this->dateOfIssue = new DateField( - $rawPrediction["date_of_issue"], - $pageId - ); - if (!isset($rawPrediction["departure_date"])) { - throw new MindeeUnsetException(); - } - $this->departureDate = new DateField( - $rawPrediction["departure_date"], - $pageId - ); - if (!isset($rawPrediction["notify_party"])) { - throw new MindeeUnsetException(); - } - $this->notifyParty = new BillOfLadingV1NotifyParty( - $rawPrediction["notify_party"], - $pageId - ); - if (!isset($rawPrediction["place_of_delivery"])) { - throw new MindeeUnsetException(); - } - $this->placeOfDelivery = new StringField( - $rawPrediction["place_of_delivery"], - $pageId - ); - if (!isset($rawPrediction["port_of_discharge"])) { - throw new MindeeUnsetException(); - } - $this->portOfDischarge = new StringField( - $rawPrediction["port_of_discharge"], - $pageId - ); - if (!isset($rawPrediction["port_of_loading"])) { - throw new MindeeUnsetException(); - } - $this->portOfLoading = new StringField( - $rawPrediction["port_of_loading"], - $pageId - ); - if (!isset($rawPrediction["shipper"])) { - throw new MindeeUnsetException(); - } - $this->shipper = new BillOfLadingV1Shipper( - $rawPrediction["shipper"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $shipperToFieldList = $this->shipper->toFieldList(); - $consigneeToFieldList = $this->consignee->toFieldList(); - $notifyPartyToFieldList = $this->notifyParty->toFieldList(); - $carrierToFieldList = $this->carrier->toFieldList(); - $carrierItemsSummary = (string) ($this->carrierItems); - - $outStr = ":Bill of Lading Number: $this->billOfLadingNumber -:Shipper: $shipperToFieldList -:Consignee: $consigneeToFieldList -:Notify Party: $notifyPartyToFieldList -:Carrier: $carrierToFieldList -:Items: $carrierItemsSummary -:Port of Loading: $this->portOfLoading -:Port of Discharge: $this->portOfDischarge -:Place of Delivery: $this->placeOfDelivery -:Date of issue: $this->dateOfIssue -:Departure Date: $this->departureDate -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1NotifyParty.php b/src/V1/Product/BillOfLading/BillOfLadingV1NotifyParty.php deleted file mode 100644 index d27b5bf4..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1NotifyParty.php +++ /dev/null @@ -1,86 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->email = $rawPrediction["email"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - $this->phone = $rawPrediction["phone"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["email"] = SummaryHelperV1::formatForDisplay($this->email); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - $outArr["phone"] = SummaryHelperV1::formatForDisplay($this->phone); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Email: " . $printable["email"]; - $outStr .= "\n :Name: " . $printable["name"]; - $outStr .= "\n :Phone: " . $printable["phone"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/BillOfLading/BillOfLadingV1Shipper.php b/src/V1/Product/BillOfLading/BillOfLadingV1Shipper.php deleted file mode 100644 index a893209b..00000000 --- a/src/V1/Product/BillOfLading/BillOfLadingV1Shipper.php +++ /dev/null @@ -1,86 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->email = $rawPrediction["email"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - $this->phone = $rawPrediction["phone"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["email"] = SummaryHelperV1::formatForDisplay($this->email); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - $outArr["phone"] = SummaryHelperV1::formatForDisplay($this->phone); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Email: " . $printable["email"]; - $outStr .= "\n :Name: " . $printable["name"]; - $outStr .= "\n :Phone: " . $printable["phone"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/DeliveryNote/DeliveryNoteV1.php b/src/V1/Product/DeliveryNote/DeliveryNoteV1.php deleted file mode 100644 index a25d325a..00000000 --- a/src/V1/Product/DeliveryNote/DeliveryNoteV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new DeliveryNoteV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(DeliveryNoteV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/DeliveryNote/DeliveryNoteV1Document.php b/src/V1/Product/DeliveryNote/DeliveryNoteV1Document.php deleted file mode 100644 index f8c8d78c..00000000 --- a/src/V1/Product/DeliveryNote/DeliveryNoteV1Document.php +++ /dev/null @@ -1,121 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["customer_address"])) { - throw new MindeeUnsetException(); - } - $this->customerAddress = new StringField( - $rawPrediction["customer_address"], - $pageId - ); - if (!isset($rawPrediction["customer_name"])) { - throw new MindeeUnsetException(); - } - $this->customerName = new StringField( - $rawPrediction["customer_name"], - $pageId - ); - if (!isset($rawPrediction["delivery_date"])) { - throw new MindeeUnsetException(); - } - $this->deliveryDate = new DateField( - $rawPrediction["delivery_date"], - $pageId - ); - if (!isset($rawPrediction["delivery_number"])) { - throw new MindeeUnsetException(); - } - $this->deliveryNumber = new StringField( - $rawPrediction["delivery_number"], - $pageId - ); - if (!isset($rawPrediction["supplier_address"])) { - throw new MindeeUnsetException(); - } - $this->supplierAddress = new StringField( - $rawPrediction["supplier_address"], - $pageId - ); - if (!isset($rawPrediction["supplier_name"])) { - throw new MindeeUnsetException(); - } - $this->supplierName = new StringField( - $rawPrediction["supplier_name"], - $pageId - ); - if (!isset($rawPrediction["total_amount"])) { - throw new MindeeUnsetException(); - } - $this->totalAmount = new AmountField( - $rawPrediction["total_amount"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - - $outStr = ":Delivery Date: $this->deliveryDate -:Delivery Number: $this->deliveryNumber -:Supplier Name: $this->supplierName -:Supplier Address: $this->supplierAddress -:Customer Name: $this->customerName -:Customer Address: $this->customerAddress -:Total Amount: $this->totalAmount -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1.php deleted file mode 100644 index dce12ef9..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new EnergyBillV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(EnergyBillV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Document.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1Document.php deleted file mode 100644 index d1c7cbd2..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Document.php +++ /dev/null @@ -1,212 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["contract_id"])) { - throw new MindeeUnsetException(); - } - $this->contractId = new StringField( - $rawPrediction["contract_id"], - $pageId - ); - if (!isset($rawPrediction["delivery_point"])) { - throw new MindeeUnsetException(); - } - $this->deliveryPoint = new StringField( - $rawPrediction["delivery_point"], - $pageId - ); - if (!isset($rawPrediction["due_date"])) { - throw new MindeeUnsetException(); - } - $this->dueDate = new DateField( - $rawPrediction["due_date"], - $pageId - ); - if (!isset($rawPrediction["energy_consumer"])) { - throw new MindeeUnsetException(); - } - $this->energyConsumer = new EnergyBillV1EnergyConsumer( - $rawPrediction["energy_consumer"], - $pageId - ); - if (!isset($rawPrediction["energy_supplier"])) { - throw new MindeeUnsetException(); - } - $this->energySupplier = new EnergyBillV1EnergySupplier( - $rawPrediction["energy_supplier"], - $pageId - ); - if (!isset($rawPrediction["energy_usage"])) { - throw new MindeeUnsetException(); - } - $this->energyUsage = new EnergyBillV1EnergyUsages( - $rawPrediction["energy_usage"], - $pageId - ); - if (!isset($rawPrediction["invoice_date"])) { - throw new MindeeUnsetException(); - } - $this->invoiceDate = new DateField( - $rawPrediction["invoice_date"], - $pageId - ); - if (!isset($rawPrediction["invoice_number"])) { - throw new MindeeUnsetException(); - } - $this->invoiceNumber = new StringField( - $rawPrediction["invoice_number"], - $pageId - ); - if (!isset($rawPrediction["meter_details"])) { - throw new MindeeUnsetException(); - } - $this->meterDetails = new EnergyBillV1MeterDetail( - $rawPrediction["meter_details"], - $pageId - ); - if (!isset($rawPrediction["subscription"])) { - throw new MindeeUnsetException(); - } - $this->subscription = new EnergyBillV1Subscriptions( - $rawPrediction["subscription"], - $pageId - ); - if (!isset($rawPrediction["taxes_and_contributions"])) { - throw new MindeeUnsetException(); - } - $this->taxesAndContributions = new EnergyBillV1TaxesAndContributions( - $rawPrediction["taxes_and_contributions"], - $pageId - ); - if (!isset($rawPrediction["total_amount"])) { - throw new MindeeUnsetException(); - } - $this->totalAmount = new AmountField( - $rawPrediction["total_amount"], - $pageId - ); - if (!isset($rawPrediction["total_before_taxes"])) { - throw new MindeeUnsetException(); - } - $this->totalBeforeTaxes = new AmountField( - $rawPrediction["total_before_taxes"], - $pageId - ); - if (!isset($rawPrediction["total_taxes"])) { - throw new MindeeUnsetException(); - } - $this->totalTaxes = new AmountField( - $rawPrediction["total_taxes"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $energySupplierToFieldList = $this->energySupplier->toFieldList(); - $energyConsumerToFieldList = $this->energyConsumer->toFieldList(); - $subscriptionSummary = (string) ($this->subscription); - $energyUsageSummary = (string) ($this->energyUsage); - $taxesAndContributionsSummary = (string) ($this->taxesAndContributions); - $meterDetailsToFieldList = $this->meterDetails->toFieldList(); - - $outStr = ":Invoice Number: $this->invoiceNumber -:Contract ID: $this->contractId -:Delivery Point: $this->deliveryPoint -:Invoice Date: $this->invoiceDate -:Due Date: $this->dueDate -:Total Before Taxes: $this->totalBeforeTaxes -:Total Taxes: $this->totalTaxes -:Total Amount: $this->totalAmount -:Energy Supplier: $energySupplierToFieldList -:Energy Consumer: $energyConsumerToFieldList -:Subscription: $subscriptionSummary -:Energy Usage: $energyUsageSummary -:Taxes and Contributions: $taxesAndContributionsSummary -:Meter Details: $meterDetailsToFieldList -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyConsumer.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyConsumer.php deleted file mode 100644 index 7d4edd8b..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyConsumer.php +++ /dev/null @@ -1,72 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Name: " . $printable["name"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergySupplier.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergySupplier.php deleted file mode 100644 index fbd394a3..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergySupplier.php +++ /dev/null @@ -1,72 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Name: " . $printable["name"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsage.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsage.php deleted file mode 100644 index 8587380c..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsage.php +++ /dev/null @@ -1,119 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->consumption = isset($rawPrediction["consumption"]) - ? (float) ($rawPrediction["consumption"]) : null; - $this->description = $rawPrediction["description"] ?? null; - $this->endDate = $rawPrediction["end_date"] ?? null; - $this->startDate = $rawPrediction["start_date"] ?? null; - $this->taxRate = isset($rawPrediction["tax_rate"]) - ? (float) ($rawPrediction["tax_rate"]) : null; - $this->total = isset($rawPrediction["total"]) - ? (float) ($rawPrediction["total"]) : null; - $this->unit = $rawPrediction["unit"] ?? null; - $this->unitPrice = isset($rawPrediction["unit_price"]) - ? (float) ($rawPrediction["unit_price"]) : null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["consumption"] = SummaryHelperV1::formatFloat($this->consumption); - $outArr["description"] = SummaryHelperV1::formatForDisplay($this->description, 36); - $outArr["endDate"] = SummaryHelperV1::formatForDisplay($this->endDate, 10); - $outArr["startDate"] = SummaryHelperV1::formatForDisplay($this->startDate); - $outArr["taxRate"] = SummaryHelperV1::formatFloat($this->taxRate); - $outArr["total"] = SummaryHelperV1::formatFloat($this->total); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit); - $outArr["unitPrice"] = SummaryHelperV1::formatFloat($this->unitPrice); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["consumption"], 11); - $outStr .= SummaryHelperV1::padString($printable["description"], 36); - $outStr .= SummaryHelperV1::padString($printable["endDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["startDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["taxRate"], 8); - $outStr .= SummaryHelperV1::padString($printable["total"], 9); - $outStr .= SummaryHelperV1::padString($printable["unit"], 15); - $outStr .= SummaryHelperV1::padString($printable["unitPrice"], 10); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsages.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsages.php deleted file mode 100644 index 9dc7dbfe..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1EnergyUsages.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class EnergyBillV1EnergyUsages extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new EnergyBillV1EnergyUsage($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function energyUsageSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 38); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 10); - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 17); - $outStr .= "+" . str_repeat($char, 12); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::energyUsageSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::energyUsageSeparator('-') . "\n "; - $outStr .= " | Consumption"; - $outStr .= " | Description "; - $outStr .= " | End Date "; - $outStr .= " | Start Date"; - $outStr .= " | Tax Rate"; - $outStr .= " | Total "; - $outStr .= " | Unit of Measure"; - $outStr .= " | Unit Price"; - $outStr .= " |\n" . self::energyUsageSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1MeterDetail.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1MeterDetail.php deleted file mode 100644 index 00dd1112..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1MeterDetail.php +++ /dev/null @@ -1,79 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->meterNumber = $rawPrediction["meter_number"] ?? null; - $this->meterType = $rawPrediction["meter_type"] ?? null; - $this->unit = $rawPrediction["unit"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["meterNumber"] = SummaryHelperV1::formatForDisplay($this->meterNumber); - $outArr["meterType"] = SummaryHelperV1::formatForDisplay($this->meterType); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Meter Number: " . $printable["meterNumber"]; - $outStr .= "\n :Meter Type: " . $printable["meterType"]; - $outStr .= "\n :Unit of Power: " . $printable["unit"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscription.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscription.php deleted file mode 100644 index aa106d59..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscription.php +++ /dev/null @@ -1,104 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->description = $rawPrediction["description"] ?? null; - $this->endDate = $rawPrediction["end_date"] ?? null; - $this->startDate = $rawPrediction["start_date"] ?? null; - $this->taxRate = isset($rawPrediction["tax_rate"]) - ? (float) ($rawPrediction["tax_rate"]) : null; - $this->total = isset($rawPrediction["total"]) - ? (float) ($rawPrediction["total"]) : null; - $this->unitPrice = isset($rawPrediction["unit_price"]) - ? (float) ($rawPrediction["unit_price"]) : null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["description"] = SummaryHelperV1::formatForDisplay($this->description, 36); - $outArr["endDate"] = SummaryHelperV1::formatForDisplay($this->endDate, 10); - $outArr["startDate"] = SummaryHelperV1::formatForDisplay($this->startDate); - $outArr["taxRate"] = SummaryHelperV1::formatFloat($this->taxRate); - $outArr["total"] = SummaryHelperV1::formatFloat($this->total); - $outArr["unitPrice"] = SummaryHelperV1::formatFloat($this->unitPrice); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["description"], 36); - $outStr .= SummaryHelperV1::padString($printable["endDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["startDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["taxRate"], 8); - $outStr .= SummaryHelperV1::padString($printable["total"], 9); - $outStr .= SummaryHelperV1::padString($printable["unitPrice"], 10); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscriptions.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscriptions.php deleted file mode 100644 index 040ca44e..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1Subscriptions.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ -class EnergyBillV1Subscriptions extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new EnergyBillV1Subscription($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function subscriptionSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 38); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 10); - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 12); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::subscriptionSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::subscriptionSeparator('-') . "\n "; - $outStr .= " | Description "; - $outStr .= " | End Date "; - $outStr .= " | Start Date"; - $outStr .= " | Tax Rate"; - $outStr .= " | Total "; - $outStr .= " | Unit Price"; - $outStr .= " |\n" . self::subscriptionSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContribution.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContribution.php deleted file mode 100644 index b7119cbe..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContribution.php +++ /dev/null @@ -1,104 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->description = $rawPrediction["description"] ?? null; - $this->endDate = $rawPrediction["end_date"] ?? null; - $this->startDate = $rawPrediction["start_date"] ?? null; - $this->taxRate = isset($rawPrediction["tax_rate"]) - ? (float) ($rawPrediction["tax_rate"]) : null; - $this->total = isset($rawPrediction["total"]) - ? (float) ($rawPrediction["total"]) : null; - $this->unitPrice = isset($rawPrediction["unit_price"]) - ? (float) ($rawPrediction["unit_price"]) : null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["description"] = SummaryHelperV1::formatForDisplay($this->description, 36); - $outArr["endDate"] = SummaryHelperV1::formatForDisplay($this->endDate, 10); - $outArr["startDate"] = SummaryHelperV1::formatForDisplay($this->startDate); - $outArr["taxRate"] = SummaryHelperV1::formatFloat($this->taxRate); - $outArr["total"] = SummaryHelperV1::formatFloat($this->total); - $outArr["unitPrice"] = SummaryHelperV1::formatFloat($this->unitPrice); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["description"], 36); - $outStr .= SummaryHelperV1::padString($printable["endDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["startDate"], 10); - $outStr .= SummaryHelperV1::padString($printable["taxRate"], 8); - $outStr .= SummaryHelperV1::padString($printable["total"], 9); - $outStr .= SummaryHelperV1::padString($printable["unitPrice"], 10); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContributions.php b/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContributions.php deleted file mode 100644 index 4604115a..00000000 --- a/src/V1/Product/Fr/EnergyBill/EnergyBillV1TaxesAndContributions.php +++ /dev/null @@ -1,74 +0,0 @@ - - */ -class EnergyBillV1TaxesAndContributions extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new EnergyBillV1TaxesAndContribution($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function taxesAndContributionsSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 38); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 12); - $outStr .= "+" . str_repeat($char, 10); - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 12); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::taxesAndContributionsSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::taxesAndContributionsSeparator('-') . "\n "; - $outStr .= " | Description "; - $outStr .= " | End Date "; - $outStr .= " | Start Date"; - $outStr .= " | Tax Rate"; - $outStr .= " | Total "; - $outStr .= " | Unit Price"; - $outStr .= " |\n" . self::taxesAndContributionsSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Fr/HealthCard/HealthCardV1.php b/src/V1/Product/Fr/HealthCard/HealthCardV1.php deleted file mode 100644 index c4cfa24d..00000000 --- a/src/V1/Product/Fr/HealthCard/HealthCardV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new HealthCardV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(HealthCardV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Fr/HealthCard/HealthCardV1Document.php b/src/V1/Product/Fr/HealthCard/HealthCardV1Document.php deleted file mode 100644 index 94fbb8e2..00000000 --- a/src/V1/Product/Fr/HealthCard/HealthCardV1Document.php +++ /dev/null @@ -1,88 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["given_names"])) { - throw new MindeeUnsetException(); - } - $this->givenNames = array_map( - static fn($prediction) => new StringField($prediction, $pageId), - $rawPrediction["given_names"] - ); - if (!isset($rawPrediction["issuance_date"])) { - throw new MindeeUnsetException(); - } - $this->issuanceDate = new DateField( - $rawPrediction["issuance_date"], - $pageId - ); - if (!isset($rawPrediction["social_security"])) { - throw new MindeeUnsetException(); - } - $this->socialSecurity = new StringField( - $rawPrediction["social_security"], - $pageId - ); - if (!isset($rawPrediction["surname"])) { - throw new MindeeUnsetException(); - } - $this->surname = new StringField( - $rawPrediction["surname"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $givenNames = implode( - "\n ", - $this->givenNames - ); - - $outStr = ":Given Name(s): $givenNames -:Surname: $this->surname -:Social Security Number: $this->socialSecurity -:Issuance Date: $this->issuanceDate -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3.php b/src/V1/Product/Fr/Payslip/PayslipV3.php deleted file mode 100644 index 643cd7b2..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new PayslipV3Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(PayslipV3Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3BankAccountDetail.php b/src/V1/Product/Fr/Payslip/PayslipV3BankAccountDetail.php deleted file mode 100644 index ead83953..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3BankAccountDetail.php +++ /dev/null @@ -1,79 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->bankName = $rawPrediction["bank_name"] ?? null; - $this->iban = $rawPrediction["iban"] ?? null; - $this->swift = $rawPrediction["swift"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["bankName"] = SummaryHelperV1::formatForDisplay($this->bankName); - $outArr["iban"] = SummaryHelperV1::formatForDisplay($this->iban); - $outArr["swift"] = SummaryHelperV1::formatForDisplay($this->swift); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Bank Name: " . $printable["bankName"]; - $outStr .= "\n :IBAN: " . $printable["iban"]; - $outStr .= "\n :SWIFT: " . $printable["swift"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3Document.php b/src/V1/Product/Fr/Payslip/PayslipV3Document.php deleted file mode 100644 index aee6b047..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3Document.php +++ /dev/null @@ -1,138 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["bank_account_details"])) { - throw new MindeeUnsetException(); - } - $this->bankAccountDetails = new PayslipV3BankAccountDetail( - $rawPrediction["bank_account_details"], - $pageId - ); - if (!isset($rawPrediction["employee"])) { - throw new MindeeUnsetException(); - } - $this->employee = new PayslipV3Employee( - $rawPrediction["employee"], - $pageId - ); - if (!isset($rawPrediction["employer"])) { - throw new MindeeUnsetException(); - } - $this->employer = new PayslipV3Employer( - $rawPrediction["employer"], - $pageId - ); - if (!isset($rawPrediction["employment"])) { - throw new MindeeUnsetException(); - } - $this->employment = new PayslipV3Employment( - $rawPrediction["employment"], - $pageId - ); - if (!isset($rawPrediction["paid_time_off"])) { - throw new MindeeUnsetException(); - } - $this->paidTimeOff = new PayslipV3PaidTimeOffs( - $rawPrediction["paid_time_off"], - $pageId - ); - if (!isset($rawPrediction["pay_detail"])) { - throw new MindeeUnsetException(); - } - $this->payDetail = new PayslipV3PayDetail( - $rawPrediction["pay_detail"], - $pageId - ); - if (!isset($rawPrediction["pay_period"])) { - throw new MindeeUnsetException(); - } - $this->payPeriod = new PayslipV3PayPeriod( - $rawPrediction["pay_period"], - $pageId - ); - if (!isset($rawPrediction["salary_details"])) { - throw new MindeeUnsetException(); - } - $this->salaryDetails = new PayslipV3SalaryDetails( - $rawPrediction["salary_details"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $payPeriodToFieldList = $this->payPeriod->toFieldList(); - $employeeToFieldList = $this->employee->toFieldList(); - $employerToFieldList = $this->employer->toFieldList(); - $bankAccountDetailsToFieldList = $this->bankAccountDetails->toFieldList(); - $employmentToFieldList = $this->employment->toFieldList(); - $salaryDetailsSummary = (string) ($this->salaryDetails); - $payDetailToFieldList = $this->payDetail->toFieldList(); - $paidTimeOffSummary = (string) ($this->paidTimeOff); - - $outStr = ":Pay Period: $payPeriodToFieldList -:Employee: $employeeToFieldList -:Employer: $employerToFieldList -:Bank Account Details: $bankAccountDetailsToFieldList -:Employment: $employmentToFieldList -:Salary Details: $salaryDetailsSummary -:Pay Detail: $payDetailToFieldList -:Paid Time Off: $paidTimeOffSummary -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3Employee.php b/src/V1/Product/Fr/Payslip/PayslipV3Employee.php deleted file mode 100644 index 2cc9ae3b..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3Employee.php +++ /dev/null @@ -1,107 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->dateOfBirth = $rawPrediction["date_of_birth"] ?? null; - $this->firstName = $rawPrediction["first_name"] ?? null; - $this->lastName = $rawPrediction["last_name"] ?? null; - $this->phoneNumber = $rawPrediction["phone_number"] ?? null; - $this->registrationNumber = $rawPrediction["registration_number"] ?? null; - $this->socialSecurityNumber = $rawPrediction["social_security_number"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["dateOfBirth"] = SummaryHelperV1::formatForDisplay($this->dateOfBirth); - $outArr["firstName"] = SummaryHelperV1::formatForDisplay($this->firstName); - $outArr["lastName"] = SummaryHelperV1::formatForDisplay($this->lastName); - $outArr["phoneNumber"] = SummaryHelperV1::formatForDisplay($this->phoneNumber); - $outArr["registrationNumber"] = SummaryHelperV1::formatForDisplay($this->registrationNumber); - $outArr["socialSecurityNumber"] = SummaryHelperV1::formatForDisplay($this->socialSecurityNumber); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Date of Birth: " . $printable["dateOfBirth"]; - $outStr .= "\n :First Name: " . $printable["firstName"]; - $outStr .= "\n :Last Name: " . $printable["lastName"]; - $outStr .= "\n :Phone Number: " . $printable["phoneNumber"]; - $outStr .= "\n :Registration Number: " . $printable["registrationNumber"]; - $outStr .= "\n :Social Security Number: " . $printable["socialSecurityNumber"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3Employer.php b/src/V1/Product/Fr/Payslip/PayslipV3Employer.php deleted file mode 100644 index 9b34639e..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3Employer.php +++ /dev/null @@ -1,107 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->address = $rawPrediction["address"] ?? null; - $this->companyId = $rawPrediction["company_id"] ?? null; - $this->companySite = $rawPrediction["company_site"] ?? null; - $this->nafCode = $rawPrediction["naf_code"] ?? null; - $this->name = $rawPrediction["name"] ?? null; - $this->phoneNumber = $rawPrediction["phone_number"] ?? null; - $this->urssafNumber = $rawPrediction["urssaf_number"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["address"] = SummaryHelperV1::formatForDisplay($this->address); - $outArr["companyId"] = SummaryHelperV1::formatForDisplay($this->companyId); - $outArr["companySite"] = SummaryHelperV1::formatForDisplay($this->companySite); - $outArr["nafCode"] = SummaryHelperV1::formatForDisplay($this->nafCode); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name); - $outArr["phoneNumber"] = SummaryHelperV1::formatForDisplay($this->phoneNumber); - $outArr["urssafNumber"] = SummaryHelperV1::formatForDisplay($this->urssafNumber); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Address: " . $printable["address"]; - $outStr .= "\n :Company ID: " . $printable["companyId"]; - $outStr .= "\n :Company Site: " . $printable["companySite"]; - $outStr .= "\n :NAF Code: " . $printable["nafCode"]; - $outStr .= "\n :Name: " . $printable["name"]; - $outStr .= "\n :Phone Number: " . $printable["phoneNumber"]; - $outStr .= "\n :URSSAF Number: " . $printable["urssafNumber"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3Employment.php b/src/V1/Product/Fr/Payslip/PayslipV3Employment.php deleted file mode 100644 index 27390d5f..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3Employment.php +++ /dev/null @@ -1,107 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->category = $rawPrediction["category"] ?? null; - $this->coefficient = $rawPrediction["coefficient"] ?? null; - $this->collectiveAgreement = $rawPrediction["collective_agreement"] ?? null; - $this->jobTitle = $rawPrediction["job_title"] ?? null; - $this->positionLevel = $rawPrediction["position_level"] ?? null; - $this->seniorityDate = $rawPrediction["seniority_date"] ?? null; - $this->startDate = $rawPrediction["start_date"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["category"] = SummaryHelperV1::formatForDisplay($this->category); - $outArr["coefficient"] = SummaryHelperV1::formatForDisplay($this->coefficient); - $outArr["collectiveAgreement"] = SummaryHelperV1::formatForDisplay($this->collectiveAgreement); - $outArr["jobTitle"] = SummaryHelperV1::formatForDisplay($this->jobTitle); - $outArr["positionLevel"] = SummaryHelperV1::formatForDisplay($this->positionLevel); - $outArr["seniorityDate"] = SummaryHelperV1::formatForDisplay($this->seniorityDate); - $outArr["startDate"] = SummaryHelperV1::formatForDisplay($this->startDate); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Category: " . $printable["category"]; - $outStr .= "\n :Coefficient: " . $printable["coefficient"]; - $outStr .= "\n :Collective Agreement: " . $printable["collectiveAgreement"]; - $outStr .= "\n :Job Title: " . $printable["jobTitle"]; - $outStr .= "\n :Position Level: " . $printable["positionLevel"]; - $outStr .= "\n :Seniority Date: " . $printable["seniorityDate"]; - $outStr .= "\n :Start Date: " . $printable["startDate"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOff.php b/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOff.php deleted file mode 100644 index fa691052..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOff.php +++ /dev/null @@ -1,97 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->accrued = isset($rawPrediction["accrued"]) - ? (float) ($rawPrediction["accrued"]) : null; - $this->period = $rawPrediction["period"] ?? null; - $this->ptoType = $rawPrediction["pto_type"] ?? null; - $this->remaining = isset($rawPrediction["remaining"]) - ? (float) ($rawPrediction["remaining"]) : null; - $this->used = isset($rawPrediction["used"]) - ? (float) ($rawPrediction["used"]) : null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["accrued"] = SummaryHelperV1::formatFloat($this->accrued); - $outArr["period"] = SummaryHelperV1::formatForDisplay($this->period, 6); - $outArr["ptoType"] = SummaryHelperV1::formatForDisplay($this->ptoType, 11); - $outArr["remaining"] = SummaryHelperV1::formatFloat($this->remaining); - $outArr["used"] = SummaryHelperV1::formatFloat($this->used); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["accrued"], 9); - $outStr .= SummaryHelperV1::padString($printable["period"], 6); - $outStr .= SummaryHelperV1::padString($printable["ptoType"], 11); - $outStr .= SummaryHelperV1::padString($printable["remaining"], 9); - $outStr .= SummaryHelperV1::padString($printable["used"], 9); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOffs.php b/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOffs.php deleted file mode 100644 index 8fc8dc9c..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3PaidTimeOffs.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class PayslipV3PaidTimeOffs extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new PayslipV3PaidTimeOff($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function paidTimeOffSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 8); - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 11); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::paidTimeOffSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::paidTimeOffSeparator('-') . "\n "; - $outStr .= " | Accrued "; - $outStr .= " | Period"; - $outStr .= " | Type "; - $outStr .= " | Remaining"; - $outStr .= " | Used "; - $outStr .= " |\n" . self::paidTimeOffSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3PayDetail.php b/src/V1/Product/Fr/Payslip/PayslipV3PayDetail.php deleted file mode 100644 index 795781da..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3PayDetail.php +++ /dev/null @@ -1,138 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->grossSalary = isset($rawPrediction["gross_salary"]) - ? (float) ($rawPrediction["gross_salary"]) : null; - $this->grossSalaryYtd = isset($rawPrediction["gross_salary_ytd"]) - ? (float) ($rawPrediction["gross_salary_ytd"]) : null; - $this->incomeTaxRate = isset($rawPrediction["income_tax_rate"]) - ? (float) ($rawPrediction["income_tax_rate"]) : null; - $this->incomeTaxWithheld = isset($rawPrediction["income_tax_withheld"]) - ? (float) ($rawPrediction["income_tax_withheld"]) : null; - $this->netPaid = isset($rawPrediction["net_paid"]) - ? (float) ($rawPrediction["net_paid"]) : null; - $this->netPaidBeforeTax = isset($rawPrediction["net_paid_before_tax"]) - ? (float) ($rawPrediction["net_paid_before_tax"]) : null; - $this->netTaxable = isset($rawPrediction["net_taxable"]) - ? (float) ($rawPrediction["net_taxable"]) : null; - $this->netTaxableYtd = isset($rawPrediction["net_taxable_ytd"]) - ? (float) ($rawPrediction["net_taxable_ytd"]) : null; - $this->totalCostEmployer = isset($rawPrediction["total_cost_employer"]) - ? (float) ($rawPrediction["total_cost_employer"]) : null; - $this->totalTaxesAndDeductions = isset($rawPrediction["total_taxes_and_deductions"]) - ? (float) ($rawPrediction["total_taxes_and_deductions"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["grossSalary"] = SummaryHelperV1::formatFloat($this->grossSalary); - $outArr["grossSalaryYtd"] = SummaryHelperV1::formatFloat($this->grossSalaryYtd); - $outArr["incomeTaxRate"] = SummaryHelperV1::formatFloat($this->incomeTaxRate); - $outArr["incomeTaxWithheld"] = SummaryHelperV1::formatFloat($this->incomeTaxWithheld); - $outArr["netPaid"] = SummaryHelperV1::formatFloat($this->netPaid); - $outArr["netPaidBeforeTax"] = SummaryHelperV1::formatFloat($this->netPaidBeforeTax); - $outArr["netTaxable"] = SummaryHelperV1::formatFloat($this->netTaxable); - $outArr["netTaxableYtd"] = SummaryHelperV1::formatFloat($this->netTaxableYtd); - $outArr["totalCostEmployer"] = SummaryHelperV1::formatFloat($this->totalCostEmployer); - $outArr["totalTaxesAndDeductions"] = SummaryHelperV1::formatFloat($this->totalTaxesAndDeductions); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Gross Salary: " . $printable["grossSalary"]; - $outStr .= "\n :Gross Salary YTD: " . $printable["grossSalaryYtd"]; - $outStr .= "\n :Income Tax Rate: " . $printable["incomeTaxRate"]; - $outStr .= "\n :Income Tax Withheld: " . $printable["incomeTaxWithheld"]; - $outStr .= "\n :Net Paid: " . $printable["netPaid"]; - $outStr .= "\n :Net Paid Before Tax: " . $printable["netPaidBeforeTax"]; - $outStr .= "\n :Net Taxable: " . $printable["netTaxable"]; - $outStr .= "\n :Net Taxable YTD: " . $printable["netTaxableYtd"]; - $outStr .= "\n :Total Cost Employer: " . $printable["totalCostEmployer"]; - $outStr .= "\n :Total Taxes and Deductions: " . $printable["totalTaxesAndDeductions"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3PayPeriod.php b/src/V1/Product/Fr/Payslip/PayslipV3PayPeriod.php deleted file mode 100644 index a3550b72..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3PayPeriod.php +++ /dev/null @@ -1,93 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->endDate = $rawPrediction["end_date"] ?? null; - $this->month = $rawPrediction["month"] ?? null; - $this->paymentDate = $rawPrediction["payment_date"] ?? null; - $this->startDate = $rawPrediction["start_date"] ?? null; - $this->year = $rawPrediction["year"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["endDate"] = SummaryHelperV1::formatForDisplay($this->endDate); - $outArr["month"] = SummaryHelperV1::formatForDisplay($this->month); - $outArr["paymentDate"] = SummaryHelperV1::formatForDisplay($this->paymentDate); - $outArr["startDate"] = SummaryHelperV1::formatForDisplay($this->startDate); - $outArr["year"] = SummaryHelperV1::formatForDisplay($this->year); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :End Date: " . $printable["endDate"]; - $outStr .= "\n :Month: " . $printable["month"]; - $outStr .= "\n :Payment Date: " . $printable["paymentDate"]; - $outStr .= "\n :Start Date: " . $printable["startDate"]; - $outStr .= "\n :Year: " . $printable["year"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetail.php b/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetail.php deleted file mode 100644 index 8705c39d..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetail.php +++ /dev/null @@ -1,98 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->amount = isset($rawPrediction["amount"]) - ? (float) ($rawPrediction["amount"]) : null; - $this->base = isset($rawPrediction["base"]) - ? (float) ($rawPrediction["base"]) : null; - $this->description = $rawPrediction["description"] ?? null; - $this->number = isset($rawPrediction["number"]) - ? (float) ($rawPrediction["number"]) : null; - $this->rate = isset($rawPrediction["rate"]) - ? (float) ($rawPrediction["rate"]) : null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["amount"] = SummaryHelperV1::formatFloat($this->amount); - $outArr["base"] = SummaryHelperV1::formatFloat($this->base); - $outArr["description"] = SummaryHelperV1::formatForDisplay($this->description, 36); - $outArr["number"] = SummaryHelperV1::formatFloat($this->number); - $outArr["rate"] = SummaryHelperV1::formatFloat($this->rate); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["amount"], 12); - $outStr .= SummaryHelperV1::padString($printable["base"], 9); - $outStr .= SummaryHelperV1::padString($printable["description"], 36); - $outStr .= SummaryHelperV1::padString($printable["number"], 6); - $outStr .= SummaryHelperV1::padString($printable["rate"], 9); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetails.php b/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetails.php deleted file mode 100644 index 833a56da..00000000 --- a/src/V1/Product/Fr/Payslip/PayslipV3SalaryDetails.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class PayslipV3SalaryDetails extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new PayslipV3SalaryDetail($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function salaryDetailsSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 14); - $outStr .= "+" . str_repeat($char, 11); - $outStr .= "+" . str_repeat($char, 38); - $outStr .= "+" . str_repeat($char, 8); - $outStr .= "+" . str_repeat($char, 11); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::salaryDetailsSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::salaryDetailsSeparator('-') . "\n "; - $outStr .= " | Amount "; - $outStr .= " | Base "; - $outStr .= " | Description "; - $outStr .= " | Number"; - $outStr .= " | Rate "; - $outStr .= " |\n" . self::salaryDetailsSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Ind/IndianPassport/IndianPassportV1.php b/src/V1/Product/Ind/IndianPassport/IndianPassportV1.php deleted file mode 100644 index e6672a1c..00000000 --- a/src/V1/Product/Ind/IndianPassport/IndianPassportV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new IndianPassportV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(IndianPassportV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Ind/IndianPassport/IndianPassportV1Document.php b/src/V1/Product/Ind/IndianPassport/IndianPassportV1Document.php deleted file mode 100644 index b23024a6..00000000 --- a/src/V1/Product/Ind/IndianPassport/IndianPassportV1Document.php +++ /dev/null @@ -1,313 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["address1"])) { - throw new MindeeUnsetException(); - } - $this->address1 = new StringField( - $rawPrediction["address1"], - $pageId - ); - if (!isset($rawPrediction["address2"])) { - throw new MindeeUnsetException(); - } - $this->address2 = new StringField( - $rawPrediction["address2"], - $pageId - ); - if (!isset($rawPrediction["address3"])) { - throw new MindeeUnsetException(); - } - $this->address3 = new StringField( - $rawPrediction["address3"], - $pageId - ); - if (!isset($rawPrediction["birth_date"])) { - throw new MindeeUnsetException(); - } - $this->birthDate = new DateField( - $rawPrediction["birth_date"], - $pageId - ); - if (!isset($rawPrediction["birth_place"])) { - throw new MindeeUnsetException(); - } - $this->birthPlace = new StringField( - $rawPrediction["birth_place"], - $pageId - ); - if (!isset($rawPrediction["country"])) { - throw new MindeeUnsetException(); - } - $this->country = new StringField( - $rawPrediction["country"], - $pageId - ); - if (!isset($rawPrediction["expiry_date"])) { - throw new MindeeUnsetException(); - } - $this->expiryDate = new DateField( - $rawPrediction["expiry_date"], - $pageId - ); - if (!isset($rawPrediction["file_number"])) { - throw new MindeeUnsetException(); - } - $this->fileNumber = new StringField( - $rawPrediction["file_number"], - $pageId - ); - if (!isset($rawPrediction["gender"])) { - throw new MindeeUnsetException(); - } - $this->gender = new ClassificationField( - $rawPrediction["gender"], - $pageId - ); - if (!isset($rawPrediction["given_names"])) { - throw new MindeeUnsetException(); - } - $this->givenNames = new StringField( - $rawPrediction["given_names"], - $pageId - ); - if (!isset($rawPrediction["id_number"])) { - throw new MindeeUnsetException(); - } - $this->idNumber = new StringField( - $rawPrediction["id_number"], - $pageId - ); - if (!isset($rawPrediction["issuance_date"])) { - throw new MindeeUnsetException(); - } - $this->issuanceDate = new DateField( - $rawPrediction["issuance_date"], - $pageId - ); - if (!isset($rawPrediction["issuance_place"])) { - throw new MindeeUnsetException(); - } - $this->issuancePlace = new StringField( - $rawPrediction["issuance_place"], - $pageId - ); - if (!isset($rawPrediction["legal_guardian"])) { - throw new MindeeUnsetException(); - } - $this->legalGuardian = new StringField( - $rawPrediction["legal_guardian"], - $pageId - ); - if (!isset($rawPrediction["mrz1"])) { - throw new MindeeUnsetException(); - } - $this->mrz1 = new StringField( - $rawPrediction["mrz1"], - $pageId - ); - if (!isset($rawPrediction["mrz2"])) { - throw new MindeeUnsetException(); - } - $this->mrz2 = new StringField( - $rawPrediction["mrz2"], - $pageId - ); - if (!isset($rawPrediction["name_of_mother"])) { - throw new MindeeUnsetException(); - } - $this->nameOfMother = new StringField( - $rawPrediction["name_of_mother"], - $pageId - ); - if (!isset($rawPrediction["name_of_spouse"])) { - throw new MindeeUnsetException(); - } - $this->nameOfSpouse = new StringField( - $rawPrediction["name_of_spouse"], - $pageId - ); - if (!isset($rawPrediction["old_passport_date_of_issue"])) { - throw new MindeeUnsetException(); - } - $this->oldPassportDateOfIssue = new DateField( - $rawPrediction["old_passport_date_of_issue"], - $pageId - ); - if (!isset($rawPrediction["old_passport_number"])) { - throw new MindeeUnsetException(); - } - $this->oldPassportNumber = new StringField( - $rawPrediction["old_passport_number"], - $pageId - ); - if (!isset($rawPrediction["old_passport_place_of_issue"])) { - throw new MindeeUnsetException(); - } - $this->oldPassportPlaceOfIssue = new StringField( - $rawPrediction["old_passport_place_of_issue"], - $pageId - ); - if (!isset($rawPrediction["page_number"])) { - throw new MindeeUnsetException(); - } - $this->pageNumber = new ClassificationField( - $rawPrediction["page_number"], - $pageId - ); - if (!isset($rawPrediction["surname"])) { - throw new MindeeUnsetException(); - } - $this->surname = new StringField( - $rawPrediction["surname"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - - $outStr = ":Page Number: $this->pageNumber -:Country: $this->country -:ID Number: $this->idNumber -:Given Names: $this->givenNames -:Surname: $this->surname -:Birth Date: $this->birthDate -:Birth Place: $this->birthPlace -:Issuance Place: $this->issuancePlace -:Gender: $this->gender -:Issuance Date: $this->issuanceDate -:Expiry Date: $this->expiryDate -:MRZ Line 1: $this->mrz1 -:MRZ Line 2: $this->mrz2 -:Legal Guardian: $this->legalGuardian -:Name of Spouse: $this->nameOfSpouse -:Name of Mother: $this->nameOfMother -:Old Passport Date of Issue: $this->oldPassportDateOfIssue -:Old Passport Number: $this->oldPassportNumber -:Old Passport Place of Issue: $this->oldPassportPlaceOfIssue -:Address Line 1: $this->address1 -:Address Line 2: $this->address2 -:Address Line 3: $this->address3 -:File Number: $this->fileNumber -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1.php deleted file mode 100644 index 067048f5..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new NutritionFactsLabelV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(NutritionFactsLabelV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1AddedSugar.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1AddedSugar.php deleted file mode 100644 index 45523691..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1AddedSugar.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Calorie.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Calorie.php deleted file mode 100644 index 546a123f..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Calorie.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Cholesterol.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Cholesterol.php deleted file mode 100644 index 6fba6887..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Cholesterol.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1DietaryFiber.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1DietaryFiber.php deleted file mode 100644 index b86ca06f..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1DietaryFiber.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Document.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Document.php deleted file mode 100644 index 66176a71..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Document.php +++ /dev/null @@ -1,216 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["added_sugars"])) { - throw new MindeeUnsetException(); - } - $this->addedSugars = new NutritionFactsLabelV1AddedSugar( - $rawPrediction["added_sugars"], - $pageId - ); - if (!isset($rawPrediction["calories"])) { - throw new MindeeUnsetException(); - } - $this->calories = new NutritionFactsLabelV1Calorie( - $rawPrediction["calories"], - $pageId - ); - if (!isset($rawPrediction["cholesterol"])) { - throw new MindeeUnsetException(); - } - $this->cholesterol = new NutritionFactsLabelV1Cholesterol( - $rawPrediction["cholesterol"], - $pageId - ); - if (!isset($rawPrediction["dietary_fiber"])) { - throw new MindeeUnsetException(); - } - $this->dietaryFiber = new NutritionFactsLabelV1DietaryFiber( - $rawPrediction["dietary_fiber"], - $pageId - ); - if (!isset($rawPrediction["nutrients"])) { - throw new MindeeUnsetException(); - } - $this->nutrients = new NutritionFactsLabelV1Nutrients( - $rawPrediction["nutrients"], - $pageId - ); - if (!isset($rawPrediction["protein"])) { - throw new MindeeUnsetException(); - } - $this->protein = new NutritionFactsLabelV1Protein( - $rawPrediction["protein"], - $pageId - ); - if (!isset($rawPrediction["saturated_fat"])) { - throw new MindeeUnsetException(); - } - $this->saturatedFat = new NutritionFactsLabelV1SaturatedFat( - $rawPrediction["saturated_fat"], - $pageId - ); - if (!isset($rawPrediction["serving_per_box"])) { - throw new MindeeUnsetException(); - } - $this->servingPerBox = new AmountField( - $rawPrediction["serving_per_box"], - $pageId - ); - if (!isset($rawPrediction["serving_size"])) { - throw new MindeeUnsetException(); - } - $this->servingSize = new NutritionFactsLabelV1ServingSize( - $rawPrediction["serving_size"], - $pageId - ); - if (!isset($rawPrediction["sodium"])) { - throw new MindeeUnsetException(); - } - $this->sodium = new NutritionFactsLabelV1Sodium( - $rawPrediction["sodium"], - $pageId - ); - if (!isset($rawPrediction["total_carbohydrate"])) { - throw new MindeeUnsetException(); - } - $this->totalCarbohydrate = new NutritionFactsLabelV1TotalCarbohydrate( - $rawPrediction["total_carbohydrate"], - $pageId - ); - if (!isset($rawPrediction["total_fat"])) { - throw new MindeeUnsetException(); - } - $this->totalFat = new NutritionFactsLabelV1TotalFat( - $rawPrediction["total_fat"], - $pageId - ); - if (!isset($rawPrediction["total_sugars"])) { - throw new MindeeUnsetException(); - } - $this->totalSugars = new NutritionFactsLabelV1TotalSugar( - $rawPrediction["total_sugars"], - $pageId - ); - if (!isset($rawPrediction["trans_fat"])) { - throw new MindeeUnsetException(); - } - $this->transFat = new NutritionFactsLabelV1TransFat( - $rawPrediction["trans_fat"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $servingSizeToFieldList = $this->servingSize->toFieldList(); - $caloriesToFieldList = $this->calories->toFieldList(); - $totalFatToFieldList = $this->totalFat->toFieldList(); - $saturatedFatToFieldList = $this->saturatedFat->toFieldList(); - $transFatToFieldList = $this->transFat->toFieldList(); - $cholesterolToFieldList = $this->cholesterol->toFieldList(); - $totalCarbohydrateToFieldList = $this->totalCarbohydrate->toFieldList(); - $dietaryFiberToFieldList = $this->dietaryFiber->toFieldList(); - $totalSugarsToFieldList = $this->totalSugars->toFieldList(); - $addedSugarsToFieldList = $this->addedSugars->toFieldList(); - $proteinToFieldList = $this->protein->toFieldList(); - $sodiumToFieldList = $this->sodium->toFieldList(); - $nutrientsSummary = (string) ($this->nutrients); - - $outStr = ":Serving per Box: $this->servingPerBox -:Serving Size: $servingSizeToFieldList -:Calories: $caloriesToFieldList -:Total Fat: $totalFatToFieldList -:Saturated Fat: $saturatedFatToFieldList -:Trans Fat: $transFatToFieldList -:Cholesterol: $cholesterolToFieldList -:Total Carbohydrate: $totalCarbohydrateToFieldList -:Dietary Fiber: $dietaryFiberToFieldList -:Total Sugars: $totalSugarsToFieldList -:Added Sugars: $addedSugarsToFieldList -:Protein: $proteinToFieldList -:sodium: $sodiumToFieldList -:nutrients: $nutrientsSummary -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrient.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrient.php deleted file mode 100644 index 8d85aa46..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrient.php +++ /dev/null @@ -1,97 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->name = $rawPrediction["name"] ?? null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - $this->unit = $rawPrediction["unit"] ?? null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["name"] = SummaryHelperV1::formatForDisplay($this->name, 20); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["dailyValue"], 11); - $outStr .= SummaryHelperV1::padString($printable["name"], 20); - $outStr .= SummaryHelperV1::padString($printable["per100G"], 8); - $outStr .= SummaryHelperV1::padString($printable["perServing"], 11); - $outStr .= SummaryHelperV1::padString($printable["unit"], 4); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrients.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrients.php deleted file mode 100644 index 82ed28cd..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Nutrients.php +++ /dev/null @@ -1,72 +0,0 @@ - - */ -class NutritionFactsLabelV1Nutrients extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new NutritionFactsLabelV1Nutrient($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function nutrientsSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 22); - $outStr .= "+" . str_repeat($char, 10); - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 6); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::nutrientsSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::nutrientsSeparator('-') . "\n "; - $outStr .= " | Daily Value"; - $outStr .= " | Name "; - $outStr .= " | Per 100g"; - $outStr .= " | Per Serving"; - $outStr .= " | Unit"; - $outStr .= " |\n" . self::nutrientsSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Protein.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Protein.php deleted file mode 100644 index 88e7122e..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Protein.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1SaturatedFat.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1SaturatedFat.php deleted file mode 100644 index 7233bb43..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1SaturatedFat.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1ServingSize.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1ServingSize.php deleted file mode 100644 index 84bc8ece..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1ServingSize.php +++ /dev/null @@ -1,73 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->amount = isset($rawPrediction["amount"]) - ? (float) ($rawPrediction["amount"]) : null; - $this->unit = $rawPrediction["unit"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["amount"] = SummaryHelperV1::formatFloat($this->amount); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Amount: " . $printable["amount"]; - $outStr .= "\n :Unit: " . $printable["unit"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Sodium.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Sodium.php deleted file mode 100644 index 7fffe0ef..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Sodium.php +++ /dev/null @@ -1,89 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - $this->unit = $rawPrediction["unit"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - $outStr .= "\n :Unit: " . $printable["unit"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalCarbohydrate.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalCarbohydrate.php deleted file mode 100644 index 281b2967..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalCarbohydrate.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalFat.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalFat.php deleted file mode 100644 index 5407464e..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalFat.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalSugar.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalSugar.php deleted file mode 100644 index 0ee3b05a..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TotalSugar.php +++ /dev/null @@ -1,83 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TransFat.php b/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TransFat.php deleted file mode 100644 index 981dc5d8..00000000 --- a/src/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1TransFat.php +++ /dev/null @@ -1,82 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->dailyValue = isset($rawPrediction["daily_value"]) - ? (float) ($rawPrediction["daily_value"]) : null; - $this->per100G = isset($rawPrediction["per_100g"]) - ? (float) ($rawPrediction["per_100g"]) : null; - $this->perServing = isset($rawPrediction["per_serving"]) - ? (float) ($rawPrediction["per_serving"]) : null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["dailyValue"] = SummaryHelperV1::formatFloat($this->dailyValue); - $outArr["per100G"] = SummaryHelperV1::formatFloat($this->per100G); - $outArr["perServing"] = SummaryHelperV1::formatFloat($this->perServing); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :Daily Value: " . $printable["dailyValue"]; - $outStr .= "\n :Per 100g: " . $printable["per100G"]; - $outStr .= "\n :Per Serving: " . $printable["perServing"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1.php b/src/V1/Product/Us/HealthcareCard/HealthcareCardV1.php deleted file mode 100644 index 56e67941..00000000 --- a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new HealthcareCardV1Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(HealthcareCardV1Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copay.php b/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copay.php deleted file mode 100644 index 77b066d2..00000000 --- a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copay.php +++ /dev/null @@ -1,74 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->serviceFees = isset($rawPrediction["service_fees"]) - ? (float) ($rawPrediction["service_fees"]) : null; - $this->serviceName = $rawPrediction["service_name"] ?? null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["serviceFees"] = SummaryHelperV1::formatFloat($this->serviceFees); - $outArr["serviceName"] = SummaryHelperV1::formatForDisplay($this->serviceName, 20); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["serviceFees"], 12); - $outStr .= SummaryHelperV1::padString($printable["serviceName"], 20); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copays.php b/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copays.php deleted file mode 100644 index 0349c0c6..00000000 --- a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Copays.php +++ /dev/null @@ -1,66 +0,0 @@ - - */ -class HealthcareCardV1Copays extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new HealthcareCardV1Copay($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function copaysSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 14); - $outStr .= "+" . str_repeat($char, 22); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::copaysSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::copaysSeparator('-') . "\n "; - $outStr .= " | Service Fees"; - $outStr .= " | Service Name "; - $outStr .= " |\n" . self::copaysSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Document.php b/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Document.php deleted file mode 100644 index ca70c8ce..00000000 --- a/src/V1/Product/Us/HealthcareCard/HealthcareCardV1Document.php +++ /dev/null @@ -1,209 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["company_name"])) { - throw new MindeeUnsetException(); - } - $this->companyName = new StringField( - $rawPrediction["company_name"], - $pageId - ); - if (!isset($rawPrediction["copays"])) { - throw new MindeeUnsetException(); - } - $this->copays = new HealthcareCardV1Copays( - $rawPrediction["copays"], - $pageId - ); - if (!isset($rawPrediction["dependents"])) { - throw new MindeeUnsetException(); - } - $this->dependents = array_map( - static fn($prediction) => new StringField($prediction, $pageId), - $rawPrediction["dependents"] - ); - if (!isset($rawPrediction["enrollment_date"])) { - throw new MindeeUnsetException(); - } - $this->enrollmentDate = new DateField( - $rawPrediction["enrollment_date"], - $pageId - ); - if (!isset($rawPrediction["group_number"])) { - throw new MindeeUnsetException(); - } - $this->groupNumber = new StringField( - $rawPrediction["group_number"], - $pageId - ); - if (!isset($rawPrediction["issuer_80840"])) { - throw new MindeeUnsetException(); - } - $this->issuer80840 = new StringField( - $rawPrediction["issuer_80840"], - $pageId - ); - if (!isset($rawPrediction["member_id"])) { - throw new MindeeUnsetException(); - } - $this->memberId = new StringField( - $rawPrediction["member_id"], - $pageId - ); - if (!isset($rawPrediction["member_name"])) { - throw new MindeeUnsetException(); - } - $this->memberName = new StringField( - $rawPrediction["member_name"], - $pageId - ); - if (!isset($rawPrediction["payer_id"])) { - throw new MindeeUnsetException(); - } - $this->payerId = new StringField( - $rawPrediction["payer_id"], - $pageId - ); - if (!isset($rawPrediction["plan_name"])) { - throw new MindeeUnsetException(); - } - $this->planName = new StringField( - $rawPrediction["plan_name"], - $pageId - ); - if (!isset($rawPrediction["rx_bin"])) { - throw new MindeeUnsetException(); - } - $this->rxBin = new StringField( - $rawPrediction["rx_bin"], - $pageId - ); - if (!isset($rawPrediction["rx_grp"])) { - throw new MindeeUnsetException(); - } - $this->rxGrp = new StringField( - $rawPrediction["rx_grp"], - $pageId - ); - if (!isset($rawPrediction["rx_id"])) { - throw new MindeeUnsetException(); - } - $this->rxId = new StringField( - $rawPrediction["rx_id"], - $pageId - ); - if (!isset($rawPrediction["rx_pcn"])) { - throw new MindeeUnsetException(); - } - $this->rxPcn = new StringField( - $rawPrediction["rx_pcn"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $dependents = implode( - "\n ", - $this->dependents - ); - $copaysSummary = (string) ($this->copays); - - $outStr = ":Company Name: $this->companyName -:Plan Name: $this->planName -:Member Name: $this->memberName -:Member ID: $this->memberId -:Issuer 80840: $this->issuer80840 -:Dependents: $dependents -:Group Number: $this->groupNumber -:Payer ID: $this->payerId -:RX BIN: $this->rxBin -:RX ID: $this->rxId -:RX GRP: $this->rxGrp -:RX PCN: $this->rxPcn -:Copays: $copaysSummary -:Enrollment Date: $this->enrollmentDate -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Us/UsMail/UsMailV3.php b/src/V1/Product/Us/UsMail/UsMailV3.php deleted file mode 100644 index b95325b7..00000000 --- a/src/V1/Product/Us/UsMail/UsMailV3.php +++ /dev/null @@ -1,42 +0,0 @@ -> $rawPrediction Raw prediction from the HTTP response. - */ - public function __construct(array $rawPrediction) - { - parent::__construct($rawPrediction); - $this->prediction = new UsMailV3Document($rawPrediction['prediction']); - $this->pages = []; - foreach ($rawPrediction['pages'] as $page) { - try { - $this->pages[] = new Page(UsMailV3Document::class, $page); - } catch (MindeeUnsetException) { - } - } - } -} diff --git a/src/V1/Product/Us/UsMail/UsMailV3Document.php b/src/V1/Product/Us/UsMail/UsMailV3Document.php deleted file mode 100644 index 276893a4..00000000 --- a/src/V1/Product/Us/UsMail/UsMailV3Document.php +++ /dev/null @@ -1,102 +0,0 @@ -> $rawPrediction Raw prediction from HTTP response. - * @param integer|null $pageId Page number for multi pages document. - * @throws MindeeUnsetException Throws if a field doesn't appear in the response. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - if (!isset($rawPrediction["is_return_to_sender"])) { - throw new MindeeUnsetException(); - } - $this->isReturnToSender = new BooleanField( - $rawPrediction["is_return_to_sender"], - $pageId - ); - if (!isset($rawPrediction["recipient_addresses"])) { - throw new MindeeUnsetException(); - } - $this->recipientAddresses = new UsMailV3RecipientAddresses( - $rawPrediction["recipient_addresses"], - $pageId - ); - if (!isset($rawPrediction["recipient_names"])) { - throw new MindeeUnsetException(); - } - $this->recipientNames = array_map( - static fn($prediction) => new StringField($prediction, $pageId), - $rawPrediction["recipient_names"] - ); - if (!isset($rawPrediction["sender_address"])) { - throw new MindeeUnsetException(); - } - $this->senderAddress = new UsMailV3SenderAddress( - $rawPrediction["sender_address"], - $pageId - ); - if (!isset($rawPrediction["sender_name"])) { - throw new MindeeUnsetException(); - } - $this->senderName = new StringField( - $rawPrediction["sender_name"], - $pageId - ); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - $senderAddressToFieldList = $this->senderAddress->toFieldList(); - $recipientNames = implode( - "\n ", - $this->recipientNames - ); - $recipientAddressesSummary = (string) ($this->recipientAddresses); - - $outStr = ":Sender Name: $this->senderName -:Sender Address: $senderAddressToFieldList -:Recipient Names: $recipientNames -:Recipient Addresses: $recipientAddressesSummary -:Return to Sender: $this->isReturnToSender -"; - return SummaryHelperV1::cleanOutString($outStr); - } -} diff --git a/src/V1/Product/Us/UsMail/UsMailV3RecipientAddress.php b/src/V1/Product/Us/UsMail/UsMailV3RecipientAddress.php deleted file mode 100644 index 872ae58c..00000000 --- a/src/V1/Product/Us/UsMail/UsMailV3RecipientAddress.php +++ /dev/null @@ -1,115 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->city = $rawPrediction["city"] ?? null; - $this->complete = $rawPrediction["complete"] ?? null; - $this->isAddressChange = $rawPrediction["is_address_change"] ?? null; - $this->postalCode = $rawPrediction["postal_code"] ?? null; - $this->privateMailboxNumber = $rawPrediction["private_mailbox_number"] ?? null; - $this->state = $rawPrediction["state"] ?? null; - $this->street = $rawPrediction["street"] ?? null; - $this->unit = $rawPrediction["unit"] ?? null; - } - - /** - * Return values for printing inside an RST table. - * @return array - */ - private function tablePrintableValues(): array - { - $outArr = []; - $outArr["city"] = SummaryHelperV1::formatForDisplay($this->city, 15); - $outArr["complete"] = SummaryHelperV1::formatForDisplay($this->complete, 35); - $outArr["isAddressChange"] = SummaryHelperV1::formatForDisplay($this->isAddressChange); - $outArr["postalCode"] = SummaryHelperV1::formatForDisplay($this->postalCode); - $outArr["privateMailboxNumber"] = SummaryHelperV1::formatForDisplay($this->privateMailboxNumber); - $outArr["state"] = SummaryHelperV1::formatForDisplay($this->state); - $outArr["street"] = SummaryHelperV1::formatForDisplay($this->street, 25); - $outArr["unit"] = SummaryHelperV1::formatForDisplay($this->unit, 15); - return $outArr; - } - - /** - * Output in a format suitable for inclusion in an rST table. - * - */ - public function toTableLine(): string - { - $printable = $this->tablePrintableValues(); - $outStr = "| "; - $outStr .= SummaryHelperV1::padString($printable["city"], 15); - $outStr .= SummaryHelperV1::padString($printable["complete"], 35); - $outStr .= SummaryHelperV1::padString($printable["isAddressChange"], 17); - $outStr .= SummaryHelperV1::padString($printable["postalCode"], 11); - $outStr .= SummaryHelperV1::padString($printable["privateMailboxNumber"], 22); - $outStr .= SummaryHelperV1::padString($printable["state"], 5); - $outStr .= SummaryHelperV1::padString($printable["street"], 25); - $outStr .= SummaryHelperV1::padString($printable["unit"], 15); - return rtrim(SummaryHelperV1::cleanOutString($outStr)); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toTableLine()); - } -} diff --git a/src/V1/Product/Us/UsMail/UsMailV3RecipientAddresses.php b/src/V1/Product/Us/UsMail/UsMailV3RecipientAddresses.php deleted file mode 100644 index 652430f4..00000000 --- a/src/V1/Product/Us/UsMail/UsMailV3RecipientAddresses.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class UsMailV3RecipientAddresses extends ArrayObject implements Stringable -{ - /** - * @param array> $rawPrediction Raw prediction array. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, ?int $pageId = null) - { - $entries = []; - foreach ($rawPrediction as $entry) { - $entries[] = new UsMailV3RecipientAddress($entry, $pageId); - } - parent::__construct($entries); - } - - /** - * Creates a line of rST table-compliant string separators. - * - * @param string $char Character to use as a separator. - */ - public static function recipientAddressesSeparator(string $char): string - { - $outStr = " "; - $outStr .= "+" . str_repeat($char, 17); - $outStr .= "+" . str_repeat($char, 37); - $outStr .= "+" . str_repeat($char, 19); - $outStr .= "+" . str_repeat($char, 13); - $outStr .= "+" . str_repeat($char, 24); - $outStr .= "+" . str_repeat($char, 7); - $outStr .= "+" . str_repeat($char, 27); - $outStr .= "+" . str_repeat($char, 17); - return $outStr . "+"; - } - - - /** - * String representation. - * - */ - public function __toString(): string - { - $lines = ""; - $iterator = $this->getIterator(); - if (!$iterator->valid()) { - return ""; - } - while ($iterator->valid()) { - $entry = $iterator->current(); - $lines .= "\n " . $entry->toTableLine() . "\n" . self::recipientAddressesSeparator('-'); - $iterator->next(); - } - $outStr = "\n" . self::recipientAddressesSeparator('-') . "\n "; - $outStr .= " | City "; - $outStr .= " | Complete Address "; - $outStr .= " | Is Address Change"; - $outStr .= " | Postal Code"; - $outStr .= " | Private Mailbox Number"; - $outStr .= " | State"; - $outStr .= " | Street "; - $outStr .= " | Unit "; - $outStr .= " |\n" . self::recipientAddressesSeparator('='); - $outStr .= $lines; - return $outStr; - } -} diff --git a/src/V1/Product/Us/UsMail/UsMailV3SenderAddress.php b/src/V1/Product/Us/UsMail/UsMailV3SenderAddress.php deleted file mode 100644 index 3414229a..00000000 --- a/src/V1/Product/Us/UsMail/UsMailV3SenderAddress.php +++ /dev/null @@ -1,93 +0,0 @@ -> $rawPrediction Array containing the JSON document response. - * @param integer|null $pageId Page number for multi pages document. - */ - public function __construct(array $rawPrediction, public ?int $pageId) - { - $this->setConfidence($rawPrediction); - $this->setPosition($rawPrediction); - $this->city = $rawPrediction["city"] ?? null; - $this->complete = $rawPrediction["complete"] ?? null; - $this->postalCode = $rawPrediction["postal_code"] ?? null; - $this->state = $rawPrediction["state"] ?? null; - $this->street = $rawPrediction["street"] ?? null; - } - - /** - * Return values for printing as an array. - * @return array - */ - private function printableValues(): array - { - $outArr = []; - $outArr["city"] = SummaryHelperV1::formatForDisplay($this->city); - $outArr["complete"] = SummaryHelperV1::formatForDisplay($this->complete); - $outArr["postalCode"] = SummaryHelperV1::formatForDisplay($this->postalCode); - $outArr["state"] = SummaryHelperV1::formatForDisplay($this->state); - $outArr["street"] = SummaryHelperV1::formatForDisplay($this->street); - return $outArr; - } - /** - * Output in a format suitable for inclusion in a field list. - * - */ - public function toFieldList(): string - { - $printable = $this->printableValues(); - $outStr = ""; - $outStr .= "\n :City: " . $printable["city"]; - $outStr .= "\n :Complete Address: " . $printable["complete"]; - $outStr .= "\n :Postal Code: " . $printable["postalCode"]; - $outStr .= "\n :State: " . $printable["state"]; - $outStr .= "\n :Street: " . $printable["street"]; - return rtrim($outStr); - } - - /** - * @return string String representation. - */ - public function __toString(): string - { - return SummaryHelperV1::cleanOutString($this->toFieldList()); - } -} diff --git a/tests/V1/Product/BillOfLading/BillOfLadingV1Test.php b/tests/V1/Product/BillOfLading/BillOfLadingV1Test.php deleted file mode 100644 index a4e68e53..00000000 --- a/tests/V1/Product/BillOfLading/BillOfLadingV1Test.php +++ /dev/null @@ -1,61 +0,0 @@ -completeDoc = new Document(BillOfLadingV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(BillOfLadingV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->billOfLadingNumber->value); - self::assertNull($prediction->shipper->address); - self::assertNull($prediction->shipper->email); - self::assertNull($prediction->shipper->name); - self::assertNull($prediction->shipper->phone); - self::assertNull($prediction->consignee->address); - self::assertNull($prediction->consignee->email); - self::assertNull($prediction->consignee->name); - self::assertNull($prediction->consignee->phone); - self::assertNull($prediction->notifyParty->address); - self::assertNull($prediction->notifyParty->email); - self::assertNull($prediction->notifyParty->name); - self::assertNull($prediction->notifyParty->phone); - self::assertNull($prediction->carrier->name); - self::assertNull($prediction->carrier->professionalNumber); - self::assertNull($prediction->carrier->scac); - self::assertCount(0, $prediction->carrierItems); - self::assertNull($prediction->portOfLoading->value); - self::assertNull($prediction->portOfDischarge->value); - self::assertNull($prediction->placeOfDelivery->value); - self::assertNull($prediction->dateOfIssue->value); - self::assertNull($prediction->departureDate->value); - } -} diff --git a/tests/V1/Product/DeliveryNote/DeliveryNoteV1Test.php b/tests/V1/Product/DeliveryNote/DeliveryNoteV1Test.php deleted file mode 100644 index da3ab166..00000000 --- a/tests/V1/Product/DeliveryNote/DeliveryNoteV1Test.php +++ /dev/null @@ -1,46 +0,0 @@ -completeDoc = new Document(DeliveryNoteV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(DeliveryNoteV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->deliveryDate->value); - self::assertNull($prediction->deliveryNumber->value); - self::assertNull($prediction->supplierName->value); - self::assertNull($prediction->supplierAddress->value); - self::assertNull($prediction->customerName->value); - self::assertNull($prediction->customerAddress->value); - self::assertNull($prediction->totalAmount->value); - } -} diff --git a/tests/V1/Product/Fr/EnergyBill/EnergyBillV1Test.php b/tests/V1/Product/Fr/EnergyBill/EnergyBillV1Test.php deleted file mode 100644 index 08b37113..00000000 --- a/tests/V1/Product/Fr/EnergyBill/EnergyBillV1Test.php +++ /dev/null @@ -1,57 +0,0 @@ -completeDoc = new Document(EnergyBillV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(EnergyBillV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->invoiceNumber->value); - self::assertNull($prediction->contractId->value); - self::assertNull($prediction->deliveryPoint->value); - self::assertNull($prediction->invoiceDate->value); - self::assertNull($prediction->dueDate->value); - self::assertNull($prediction->totalBeforeTaxes->value); - self::assertNull($prediction->totalTaxes->value); - self::assertNull($prediction->totalAmount->value); - self::assertNull($prediction->energySupplier->address); - self::assertNull($prediction->energySupplier->name); - self::assertNull($prediction->energyConsumer->address); - self::assertNull($prediction->energyConsumer->name); - self::assertCount(0, $prediction->subscription); - self::assertCount(0, $prediction->energyUsage); - self::assertCount(0, $prediction->taxesAndContributions); - self::assertNull($prediction->meterDetails->meterNumber); - self::assertNull($prediction->meterDetails->meterType); - self::assertNull($prediction->meterDetails->unit); - } -} diff --git a/tests/V1/Product/Fr/HealthCard/HealthCardV1Test.php b/tests/V1/Product/Fr/HealthCard/HealthCardV1Test.php deleted file mode 100644 index cd38fe07..00000000 --- a/tests/V1/Product/Fr/HealthCard/HealthCardV1Test.php +++ /dev/null @@ -1,43 +0,0 @@ -completeDoc = new Document(HealthCardV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(HealthCardV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertCount(0, $prediction->givenNames); - self::assertNull($prediction->surname->value); - self::assertNull($prediction->socialSecurity->value); - self::assertNull($prediction->issuanceDate->value); - } -} diff --git a/tests/V1/Product/Fr/Payslip/PayslipV3Test.php b/tests/V1/Product/Fr/Payslip/PayslipV3Test.php deleted file mode 100644 index 5c8cbb0a..00000000 --- a/tests/V1/Product/Fr/Payslip/PayslipV3Test.php +++ /dev/null @@ -1,80 +0,0 @@ -completeDoc = new Document(PayslipV3::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(PayslipV3::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->payPeriod->endDate); - self::assertNull($prediction->payPeriod->month); - self::assertNull($prediction->payPeriod->paymentDate); - self::assertNull($prediction->payPeriod->startDate); - self::assertNull($prediction->payPeriod->year); - self::assertNull($prediction->employee->address); - self::assertNull($prediction->employee->dateOfBirth); - self::assertNull($prediction->employee->firstName); - self::assertNull($prediction->employee->lastName); - self::assertNull($prediction->employee->phoneNumber); - self::assertNull($prediction->employee->registrationNumber); - self::assertNull($prediction->employee->socialSecurityNumber); - self::assertNull($prediction->employer->address); - self::assertNull($prediction->employer->companyId); - self::assertNull($prediction->employer->companySite); - self::assertNull($prediction->employer->nafCode); - self::assertNull($prediction->employer->name); - self::assertNull($prediction->employer->phoneNumber); - self::assertNull($prediction->employer->urssafNumber); - self::assertNull($prediction->bankAccountDetails->bankName); - self::assertNull($prediction->bankAccountDetails->iban); - self::assertNull($prediction->bankAccountDetails->swift); - self::assertNull($prediction->employment->category); - self::assertNull($prediction->employment->coefficient); - self::assertNull($prediction->employment->collectiveAgreement); - self::assertNull($prediction->employment->jobTitle); - self::assertNull($prediction->employment->positionLevel); - self::assertNull($prediction->employment->seniorityDate); - self::assertNull($prediction->employment->startDate); - self::assertCount(0, $prediction->salaryDetails); - self::assertNull($prediction->payDetail->grossSalary); - self::assertNull($prediction->payDetail->grossSalaryYtd); - self::assertNull($prediction->payDetail->incomeTaxRate); - self::assertNull($prediction->payDetail->incomeTaxWithheld); - self::assertNull($prediction->payDetail->netPaid); - self::assertNull($prediction->payDetail->netPaidBeforeTax); - self::assertNull($prediction->payDetail->netTaxable); - self::assertNull($prediction->payDetail->netTaxableYtd); - self::assertNull($prediction->payDetail->totalCostEmployer); - self::assertNull($prediction->payDetail->totalTaxesAndDeductions); - self::assertCount(0, $prediction->paidTimeOff); - } -} diff --git a/tests/V1/Product/Ind/IndianPassport/IndianPassportV1Test.php b/tests/V1/Product/Ind/IndianPassport/IndianPassportV1Test.php deleted file mode 100644 index 7b79bc5f..00000000 --- a/tests/V1/Product/Ind/IndianPassport/IndianPassportV1Test.php +++ /dev/null @@ -1,60 +0,0 @@ -completeDoc = new Document(IndianPassportV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(IndianPassportV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->country->value); - self::assertNull($prediction->idNumber->value); - self::assertNull($prediction->givenNames->value); - self::assertNull($prediction->surname->value); - self::assertNull($prediction->birthDate->value); - self::assertNull($prediction->birthPlace->value); - self::assertNull($prediction->issuancePlace->value); - self::assertNull($prediction->issuanceDate->value); - self::assertNull($prediction->expiryDate->value); - self::assertNull($prediction->mrz1->value); - self::assertNull($prediction->mrz2->value); - self::assertNull($prediction->legalGuardian->value); - self::assertNull($prediction->nameOfSpouse->value); - self::assertNull($prediction->nameOfMother->value); - self::assertNull($prediction->oldPassportDateOfIssue->value); - self::assertNull($prediction->oldPassportNumber->value); - self::assertNull($prediction->oldPassportPlaceOfIssue->value); - self::assertNull($prediction->address1->value); - self::assertNull($prediction->address2->value); - self::assertNull($prediction->address3->value); - self::assertNull($prediction->fileNumber->value); - } -} diff --git a/tests/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Test.php b/tests/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Test.php deleted file mode 100644 index 2972b3b1..00000000 --- a/tests/V1/Product/NutritionFactsLabel/NutritionFactsLabelV1Test.php +++ /dev/null @@ -1,77 +0,0 @@ -completeDoc = new Document(NutritionFactsLabelV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(NutritionFactsLabelV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->servingPerBox->value); - self::assertNull($prediction->servingSize->amount); - self::assertNull($prediction->servingSize->unit); - self::assertNull($prediction->calories->dailyValue); - self::assertNull($prediction->calories->per100G); - self::assertNull($prediction->calories->perServing); - self::assertNull($prediction->totalFat->dailyValue); - self::assertNull($prediction->totalFat->per100G); - self::assertNull($prediction->totalFat->perServing); - self::assertNull($prediction->saturatedFat->dailyValue); - self::assertNull($prediction->saturatedFat->per100G); - self::assertNull($prediction->saturatedFat->perServing); - self::assertNull($prediction->transFat->dailyValue); - self::assertNull($prediction->transFat->per100G); - self::assertNull($prediction->transFat->perServing); - self::assertNull($prediction->cholesterol->dailyValue); - self::assertNull($prediction->cholesterol->per100G); - self::assertNull($prediction->cholesterol->perServing); - self::assertNull($prediction->totalCarbohydrate->dailyValue); - self::assertNull($prediction->totalCarbohydrate->per100G); - self::assertNull($prediction->totalCarbohydrate->perServing); - self::assertNull($prediction->dietaryFiber->dailyValue); - self::assertNull($prediction->dietaryFiber->per100G); - self::assertNull($prediction->dietaryFiber->perServing); - self::assertNull($prediction->totalSugars->dailyValue); - self::assertNull($prediction->totalSugars->per100G); - self::assertNull($prediction->totalSugars->perServing); - self::assertNull($prediction->addedSugars->dailyValue); - self::assertNull($prediction->addedSugars->per100G); - self::assertNull($prediction->addedSugars->perServing); - self::assertNull($prediction->protein->dailyValue); - self::assertNull($prediction->protein->per100G); - self::assertNull($prediction->protein->perServing); - self::assertNull($prediction->sodium->dailyValue); - self::assertNull($prediction->sodium->per100G); - self::assertNull($prediction->sodium->perServing); - self::assertNull($prediction->sodium->unit); - self::assertCount(0, $prediction->nutrients); - } -} diff --git a/tests/V1/Product/Us/HealthcareCard/HealthcareCardV1Test.php b/tests/V1/Product/Us/HealthcareCard/HealthcareCardV1Test.php deleted file mode 100644 index a276fa84..00000000 --- a/tests/V1/Product/Us/HealthcareCard/HealthcareCardV1Test.php +++ /dev/null @@ -1,53 +0,0 @@ -completeDoc = new Document(HealthcareCardV1::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(HealthcareCardV1::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->companyName->value); - self::assertNull($prediction->planName->value); - self::assertNull($prediction->memberName->value); - self::assertNull($prediction->memberId->value); - self::assertNull($prediction->issuer80840->value); - self::assertCount(0, $prediction->dependents); - self::assertNull($prediction->groupNumber->value); - self::assertNull($prediction->payerId->value); - self::assertNull($prediction->rxBin->value); - self::assertNull($prediction->rxId->value); - self::assertNull($prediction->rxGrp->value); - self::assertNull($prediction->rxPcn->value); - self::assertCount(0, $prediction->copays); - self::assertNull($prediction->enrollmentDate->value); - } -} diff --git a/tests/V1/Product/Us/UsMail/UsMailV3Test.php b/tests/V1/Product/Us/UsMail/UsMailV3Test.php deleted file mode 100644 index 772edbf2..00000000 --- a/tests/V1/Product/Us/UsMail/UsMailV3Test.php +++ /dev/null @@ -1,48 +0,0 @@ -completeDoc = new Document(UsMailV3::class, $completeDocJSON["document"]); - $this->emptyDoc = new Document(UsMailV3::class, $emptyDocJSON["document"]); - $this->completeDocReference = file_get_contents($productDir . "summary_full.rst"); - } - - public function testCompleteDoc(): void - { - self::assertSame($this->completeDocReference, (string) ($this->completeDoc)); - } - - public function testEmptyDoc(): void - { - $prediction = $this->emptyDoc->inference->prediction; - self::assertNull($prediction->senderName->value); - self::assertNull($prediction->senderAddress->city); - self::assertNull($prediction->senderAddress->complete); - self::assertNull($prediction->senderAddress->postalCode); - self::assertNull($prediction->senderAddress->state); - self::assertNull($prediction->senderAddress->street); - self::assertCount(0, $prediction->recipientNames); - self::assertCount(0, $prediction->recipientAddresses); - self::assertNull($prediction->isReturnToSender->value); - } -}