-
Notifications
You must be signed in to change notification settings - Fork 27
Class ZugferdKositValidator
Class representing the validator against Schematron (Kosit) for documents
$kositValidator = new ZugferdKositValidator();
$document = ZugferdDocumentPdfReader::readAndGuessFromFile("/tmp/invoice.pdf");
$kositValidator->setDocument($document)->disableCleanup()->validate();
if ($kositValidator->hasValidationErrors()) {
echo "Validation failed";
foreach ($kositValidator->getValidationErrors() as $validationError) {
echo " - " . $validationError . PHP_EOL;
}
} else {
echo "mValidation passed";
}
$kositValidator = new ZugferdKositValidator();
$document = ZugferdDocumentReader::readAndGuessFromFile("/tmp/factur-x.xml");
$kositValidator->setDocument($document)->disableCleanup()->validate();
if ($kositValidator->hasValidationErrors()) {
echo "Validation failed";
foreach ($kositValidator->getValidationErrors() as $validationError) {
echo " - " . $validationError . PHP_EOL;
}
} else {
echo "mValidation passed";
}
Constructor
public function __construct(?horstoeko\zugferd\ZugferdDocument $document = null): void;
Name | Type | Allows Null | Description |
---|---|---|---|
document | horstoeko\zugferd\ZugferdDocument | ✔️ |
Set the ZugferdDocument instance to validate
public function setDocument(horstoeko\zugferd\ZugferdDocument $document): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
document | horstoeko\zugferd\ZugferdDocument | ❌ |
Setup the base directory. In the base directory all files will be downloaded
and created
public function setBaseDirectory(string $newBaseDirectory): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newBaseDirectory | string | ❌ |
Setup the KOSIT validator application download url
public function setValidatorDownloadUrl(string $newValidatorDownloadUrl): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorDownloadUrl | string | ❌ |
Setup the KOSIT validator scenario download url
public function setValidatorScenarioDownloadUrl(string $newValidatorScenarioDownloadUrl): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorScenarioDownloadUrl | string | ❌ |
Set the filename of the ZIP file which contains the validation application
public function setValidatorAppZipFilename(string $newValidatorAppZipFilename): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorAppZipFilename | string | ❌ |
Set the filename of the ZIP file which contains the validation scenarios
public function setValidatorScenarioZipFilename(string $newValidatorScenarioZipFilename): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorScenarioZipFilename | string | ❌ |
Set the filename of the applications JAR
public function setValidatorAppJarFilename(string $newValidatorAppJarFilename): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorAppJarFilename | string | ❌ |
Set the filename of the application scenario file
public function setValidatorAppScenarioFilename(string $newValidatorAppScenarioFilename): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorAppScenarioFilename | string | ❌ |
Set the filename of the file which contains the temporary xml data to validate
public function setFileToValidateFilename(string $newFileToValidateFilename): \ZugferdKositValidator;
Name | Type | Allows Null | Description |
---|---|---|---|
newFileToValidateFilename | string | ❌ |
Disable cleanup base directory
public function disableCleanup(): \ZugferdKositValidator;
Enable cleanup base directory
public function enableCleanup(): \ZugferdKositValidator;
Perform validation
public function validate(): \ZugferdKositValidator;
Returns an array of all validation errors
public function getValidationErrors(): array;
Returns true if no validation errors are present otherwise false
public function hasNoValidationErrors(): bool;
Returns true if validation errors are present otherwise false
public function hasValidationErrors(): bool;
Returns an array of all validation warnings
public function getValidationWarnings(): array;
Returns true if no validation warnings are present otherwise false
public function hasNoValidationWarnings(): bool;
Returns true if validation warnings are present otherwise false
public function hasValidationWarnings(): bool;
Returns an array of all validation information
public function getValidationInformation(): array;
Returns true if no validation information are present otherwise false
public function hasNoValidationInformation(): bool;
Returns true if validation Information are present otherwise false
public function hasValidationInformation(): bool;
Return an array of all internal errors (such as download error or system exceptions)
public function getProcessErrors(): array;
Returns true if there are no system errors (e.g. exceptions before the validation app was called)
public function hasNoProcessErrors(): bool;
Returns true if there are any system errors (e.g. exceptions before the validation app was called)
public function hasProcessErrors(): bool;
Returns an array of all messages from process system (calling external applications)
public function getProcessOutput(): array;