From 19fe1e8e7f08c9e3418d61ecbf4b4d404fbecfc4 Mon Sep 17 00:00:00 2001 From: Thomas Peterson Date: Fri, 25 Jul 2025 11:22:50 +0200 Subject: [PATCH] Fixes --- cobertura.xml | 304 +++++++++++++++++++------------------ src/Option/Parser/Base.php | 75 ++++----- 2 files changed, 191 insertions(+), 188 deletions(-) diff --git a/cobertura.xml b/cobertura.xml index 377d895..fc190d9 100644 --- a/cobertura.xml +++ b/cobertura.xml @@ -1,6 +1,6 @@ - + /home/thomas/projekte/calc/src @@ -5506,128 +5506,130 @@ - + - + - + - + - + - + - + - + - - - - - - - - - + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - + + + + + - - - - - - - + + + + + + + + - - + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -6240,9 +6242,9 @@ - + - + @@ -6354,30 +6356,30 @@ - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -6539,25 +6541,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -6877,7 +6879,7 @@ - + @@ -7109,7 +7111,7 @@ - + @@ -8460,13 +8462,13 @@ - + - + - + - + @@ -8479,9 +8481,9 @@ - + - + @@ -8489,9 +8491,9 @@ - + - + @@ -8499,9 +8501,9 @@ - + - + @@ -8509,9 +8511,9 @@ - + - + @@ -8519,25 +8521,25 @@ - + - + - + - + - + - + - + - + @@ -8658,7 +8660,7 @@ - + @@ -8668,7 +8670,7 @@ - + @@ -8678,7 +8680,7 @@ - + @@ -8732,11 +8734,11 @@ - + - + - + diff --git a/src/Option/Parser/Base.php b/src/Option/Parser/Base.php index 05bd529..e15058b 100644 --- a/src/Option/Parser/Base.php +++ b/src/Option/Parser/Base.php @@ -1,4 +1,5 @@ cache = new FilesystemAdapter(); } - public function fromXML(\SimpleXMLElement $node) { + public function fromXML(\SimpleXMLElement $node) + { $this->node = $node; } - public function fromJson(array $json) { + public function fromJson(array $json) + { $this->json = $json; } - public function toJson(): array { - + public function toJson(): array + { } - public function toXML(): \SimpleXMLElement { - + public function toXML(): \SimpleXMLElement + { } public function parseJson(): PSCBase { - $this->element->setId((string)$this->json['id']); - $this->element->setName((string)$this->json['name']); - - if(isset($this->json['default'])) { - $this->element->setDefault((string)$this->json['default']); + $this->element->setId((string) $this->json['id']); + if (isset($this->json['name'])) { + $this->element->setName((string) $this->json['name']); } - if(isset($this->json['required'])) { + if (isset($this->json['default'])) { + $this->element->setDefault((string) $this->json['default']); + } + if (isset($this->json['required'])) { $this->element->setRequire($this->json['required']); } - if(isset($this->json['exportAjax'])) { + if (isset($this->json['exportAjax'])) { $this->element->setIsAjaxExport($this->json['exportAjax']); } - if(isset($this->json['displayOnly'])) { + if (isset($this->json['displayOnly'])) { $this->element->setIsDisplayOnly($this->json['displayOnly']); } return $this->element; } - - public function parseXML(): PSCBase { - $this->element->setId((string)$this->node['id']); - $this->element->setName((string)$this->node['name']); + $this->element->setId((string) $this->node['id']); + $this->element->setName((string) $this->node['name']); - if(isset($this->node['default'])) { - $this->element->setDefault((string)$this->node['default']); + if (isset($this->node['default'])) { + $this->element->setDefault((string) $this->node['default']); } - if(isset($this->node['require'])) { + if (isset($this->node['require'])) { $this->element->setRequire($this->getBoolean($this->node['require'])); } - if(isset($this->node['required'])) { + if (isset($this->node['required'])) { $this->element->setRequire($this->getBoolean($this->node['required'])); } - if(isset($this->node['help'])) { - $this->element->setHelp((string)$this->node['help']); + if (isset($this->node['help'])) { + $this->element->setHelp((string) $this->node['help']); } - if(isset($this->node['helplink'])) { - $this->element->setHelpLink((string)$this->node['helplink']); + if (isset($this->node['helplink'])) { + $this->element->setHelpLink((string) $this->node['helplink']); } - if(isset($this->node['helpid'])) { - $this->element->setHelpId((string)$this->node['helpid']); + if (isset($this->node['helpid'])) { + $this->element->setHelpId((string) $this->node['helpid']); } - if(isset($this->node['exportAjax']) && (string)$this->node['exportAjax'] == 1) { + if (isset($this->node['exportAjax']) && ((string) $this->node['exportAjax']) == 1) { $this->element->setIsAjaxExport(true); } - if(isset($this->node['displayOnly']) && (string)$this->node['displayOnly'] == 1) { + if (isset($this->node['displayOnly']) && ((string) $this->node['displayOnly']) == 1) { $this->element->setIsDisplayOnly(true); } - if(isset($this->node['amount']) && (string)$this->node['amount'] == 0) { + if (isset($this->node['amount']) && ((string) $this->node['amount']) == 0) { $this->element->setAmount(false); } - if(isset($this->node['display_group']) && (string)$this->node['display_group'] != "") { - $this->element->setDisplayGroup((string)$this->node['display_group']); + if (isset($this->node['display_group']) && ((string) $this->node['display_group']) != '') { + $this->element->setDisplayGroup((string) $this->node['display_group']); } return $this->element; @@ -101,10 +103,9 @@ class Base private function getBoolean($value) { - if((string)$value == 'true' || (string)$value == '1') { + if (((string) $value) == 'true' || ((string) $value) == '1') { return true; } return false; } - }