Skip to content

Commit

Permalink
[ENH] More improvemets to ZugferdKositValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Dec 16, 2024
1 parent a0bc48c commit 05544c5
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/ZugferdKositValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,13 +705,32 @@ public function getProcessOutput(): array
*/
private function checkRequirements(): bool
{
if ($this->checkRequirementsGeneral()) {
return false;
}

if ($this->remoteModeEnabled === true) {
return $this->checkRequirementsRemote();
}

return $this->checkRequirementsLocal();
}

/**
* CHeck general requirements (common for local and remote validation)
*
* @return boolean
*/
private function checkRequirementsGeneral(): bool
{
if (is_null($this->document)) {
$this->addToMessageBag("You must specify an instance of the ZugferdDocument class");
return false;
}

return true;
}

/**
* CHeck requirements for usage on a local installation
*
Expand All @@ -723,11 +742,6 @@ private function checkRequirementsLocal(): bool
return true;
}

if (is_null($this->document)) {
$this->addToMessageBag("You must specify an instance of the ZugferdDocument class");
return false;
}

if (!extension_loaded('zip')) {
$this->addToMessageBag("ZIP extension not installed");
return false;
Expand Down Expand Up @@ -755,7 +769,7 @@ private function checkRequirementsRemote(): bool
return true;
}

if (!function_exists('curl_init') || !function_exists('curl_setopt') || !function_exists('curl_exec') || !function_exists('curl_getinfo') || !function_exists('curl_close')) {
if (!extension_loaded('curl')) {
$this->addToMessageBag("PHP-Curl not installed or activated");
return false;
}
Expand Down

0 comments on commit 05544c5

Please sign in to comment.