-
Notifications
You must be signed in to change notification settings - Fork 40
Class ZugferdKositValidator
Class representing the validator against Schematron (Kosit) for documents.
This class requires a JAVA running setup
$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";
}
Create a KositValidator-Instance by a given content string
public static function fromString(string $document): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
document | string | ❌ |
Returns a value of type \ZugferdKositValidator
Create a KositValidator-Instance by a given ZugferdDocument (ZugferdDocumentReader, ZugferdDocumentBuilder)
public static function fromZugferdDocument(
horstoeko\zugferd\ZugferdDocument $zugferdDocument,
): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
zugferdDocument | horstoeko\zugferd\ZugferdDocument | ❌ |
Returns a value of type \ZugferdKositValidator
Constructor
public function __construct(mixed $document = null): void
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
document | mixed | ❌ |
Set the ZugferdDocument instance to validate
public function setDocument(mixed $document): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
document | mixed | ❌ |
Returns a value of type \ZugferdKositValidator
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 | ❌ |
Returns a value of type \ZugferdKositValidator
Setup the KOSIT validator application download url
public function setValidatorDownloadUrl(string $newValidatorDownloadUrl): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorDownloadUrl | string | ❌ |
Returns a value of type \ZugferdKositValidator
Setup the KOSIT validator scenario download url
public function setValidatorScenarioDownloadUrl(string $newValidatorScenarioDownloadUrl): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorScenarioDownloadUrl | string | ❌ |
Returns a value of type \ZugferdKositValidator
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 | ❌ |
Returns a value of type \ZugferdKositValidator
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 | ❌ |
Returns a value of type \ZugferdKositValidator
Set the filename of the applications JAR
public function setValidatorAppJarFilename(string $newValidatorAppJarFilename): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorAppJarFilename | string | ❌ |
Returns a value of type \ZugferdKositValidator
Set the filename of the application scenario file
public function setValidatorAppScenarioFilename(string $newValidatorAppScenarioFilename): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
newValidatorAppScenarioFilename | string | ❌ |
Returns a value of type \ZugferdKositValidator
Disable cleanup base directory
public function disableCleanup(): \ZugferdKositValidator
{
}
Returns a value of type \ZugferdKositValidator
Enable cleanup base directory
public function enableCleanup(): \ZugferdKositValidator
{
}
Returns a value of type \ZugferdKositValidator
Disable the usage of a remote host validation
public function disableRemoteMode(): \ZugferdKositValidator
{
}
Returns a value of type \ZugferdKositValidator
Enable the usage of a remote host validation
public function enableRemoteMode(): \ZugferdKositValidator
{
}
Returns a value of type \ZugferdKositValidator
Set the hostname or the ip of the remote host where the validation application
is running in daemon mode
public function setRemoteModeHost(string $remoteModeHost): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
remoteModeHost | string | ❌ |
Returns a value of type \ZugferdKositValidator
Set the port of the remote host where the validation application
is running in daemon mode
public function setRemoteModePort(int $remoteModePort): \ZugferdKositValidator
{
}
Name | Type | Allows Null | Description |
---|---|---|---|
remoteModePort | int | ❌ |
Returns a value of type \ZugferdKositValidator
Returns the full remote mode URL
public function getRemoteModeUrl(): string
{
}
Returns a value of type string
Perform validation
public function validate(): \ZugferdKositValidator
{
}
Returns a value of type \ZugferdKositValidator
Returns an array of all validation errors
public function getValidationErrors(): array
{
}
Returns a value of type array
Returns true if no validation errors are present otherwise false
public function hasNoValidationErrors(): bool
{
}
Returns a value of type bool
Returns true if validation errors are present otherwise false
public function hasValidationErrors(): bool
{
}
Returns a value of type bool
Returns an array of all validation warnings
public function getValidationWarnings(): array
{
}
Returns a value of type array
Returns true if no validation warnings are present otherwise false
public function hasNoValidationWarnings(): bool
{
}
Returns a value of type bool
Returns true if validation warnings are present otherwise false
public function hasValidationWarnings(): bool
{
}
Returns a value of type bool
Returns an array of all validation information
public function getValidationInformation(): array
{
}
Returns a value of type array
Returns true if no validation information are present otherwise false
public function hasNoValidationInformation(): bool
{
}
Returns a value of type bool
Returns true if validation Information are present otherwise false
public function hasValidationInformation(): bool
{
}
Returns a value of type bool
Return an array of all internal errors (such as download error or system exceptions)
public function getProcessErrors(): array
{
}
Returns a value of type array
Returns true if there are no system errors (e.g. exceptions before the validation app was called)
public function hasNoProcessErrors(): bool
{
}
Returns a value of type bool
Returns true if there are any system errors (e.g. exceptions before the validation app was called)
public function hasProcessErrors(): bool
{
}
Returns a value of type bool
Returns an array of all messages from process system (calling external applications)
public function getProcessOutput(): array
{
}
Returns a value of type array