Skip to content

Commit

Permalink
Merge pull request #132 from horstoeko/checkstyle
Browse files Browse the repository at this point in the history
Fixed CheckStyle Issues
  • Loading branch information
horstoeko authored Oct 3, 2024
2 parents ecff46d + 42c9121 commit 2381ea9
Show file tree
Hide file tree
Showing 11 changed files with 431 additions and 416 deletions.
33 changes: 20 additions & 13 deletions build/phpmd.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?xml version="1.0"?>
<ruleset name="PHPMD rule sets"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Custom rule sets that checks your PHP code.</description>
<rule ref="rulesets/unusedcode.xml"/>
<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
</ruleset>

<?xml version="1.0"?>
<ruleset name="PHPMD rule sets"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Custom rule sets that checks your PHP code.</description>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedLocalVariable" />
</rule>
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable">
<properties>
<property name="exceptions" value="_" />
</properties>
</rule>
<!--<rule ref="rulesets/codesize.xml/CyclomaticComplexity"/>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList"/>-->
</ruleset>

12 changes: 6 additions & 6 deletions src/ZugferdDocumentPdfBuilderAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ protected function extractInvoiceInformations(): array
$docTypeCode = $docTypeXpath->item(0)->nodeValue;

switch ($docTypeCode) {
case ZugferdInvoiceType::CREDITNOTE:
$docTypeName = 'Credit Note';
break;
default:
$docTypeName = 'Invoice';
break;
case ZugferdInvoiceType::CREDITNOTE:
$docTypeName = 'Credit Note';
break;
default:
$docTypeName = 'Invoice';
break;
}

$invoiceInformation = array(
Expand Down
2 changes: 1 addition & 1 deletion src/ZugferdDocumentPdfReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static function getXmlFromContent(string $pdfContent): ?string
* @return null|string
* @throws Exception
*/
private static function internalExtractXMLFromPdfContent(string $pdfContent): ?string
protected static function internalExtractXMLFromPdfContent(string $pdfContent): ?string
{
$pdfParser = new PdfParser();
$pdfParsed = $pdfParser->parseContent($pdfContent);
Expand Down
5 changes: 2 additions & 3 deletions src/ZugferdDocumentReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public function setBinaryDataDirectory(string $binarydatadirectory): ZugferdDocu
* @throws ZugferdUnknownProfileParameterException
* @throws RuntimeException
*/
private function readContent(string $xmlcontent): ZugferdDocumentReader
protected function readContent(string $xmlcontent): ZugferdDocumentReader
{
$this->deserialize($xmlcontent);

Expand Down Expand Up @@ -2639,10 +2639,9 @@ public function getDocumentUltimateCustomerOrderReferencedDocument(?string &$iss
/**
* Details of the ultimate customer order
*
* @param array|null $refdocs
* @return ZugferdDocumentReader
*/
public function getDocumentUltimateCustomerOrderReferencedDocuments(?array $refdocs): ZugferdDocumentReader
public function getDocumentUltimateCustomerOrderReferencedDocuments(/*?array $refdocs*/): ZugferdDocumentReader
{
// TODO: Implemente method getDocumentUltimateCustomerOrderReferencedDocuments
return $this;
Expand Down
1 change: 1 addition & 0 deletions src/ZugferdObjectHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ public function getTaxApplicableTradeCurrencyExchangeType(?string $sourceCurrenc
$this->tryCall($currencyExchange, "setSourceCurrencyCode", $this->getIdType($sourceCurrencyCode));
$this->tryCall($currencyExchange, "setTargetCurrencyCode", $this->getIdType($targetCurrencyCode));
$this->tryCall($currencyExchange, "setConversionRate", $this->getRateType($rate));
$this->tryCall($currencyExchange, "setConversionRateDateTime", $this->getDateTimeType($rateDateTime));

return $currencyExchange;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ZugferdPdfWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function setPdfMetadataInfos(array $metaDataInfos): void
*/
protected function _putfiles(): void
{
foreach ($this->files as $i => &$info) {
foreach ($this->files as $_ => &$info) {
$this->putFileSpecification($info);
$info['file_index'] = $this->n;
$this->putFileStream($info);
Expand Down Expand Up @@ -299,7 +299,7 @@ protected function putMetadataDescriptions(): void
$s .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">' . "\n";
$this->_newobj();
$this->descriptionIndex = $this->n;
foreach ($this->metaDataDescriptions as $i => $desc) {
foreach ($this->metaDataDescriptions as $_ => $desc) {
$s .= $desc . "\n";
}
$s .= '</rdf:RDF>' . "\n";
Expand Down
20 changes: 4 additions & 16 deletions src/jms/ZugferdTypesHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ public static function getSubscribingMethods()
*
* @param XmlSerializationVisitor $visitor
* @param mixed $data
* @param array $type
* @param Context $context
* @return DOMText|false
*/
public function serializeAmountType(XmlSerializationVisitor $visitor, $data, array $type, Context $context)
public function serializeAmountType(XmlSerializationVisitor $visitor, $data)
{
$node = $visitor->getDocument()->createTextNode(
number_format(
Expand All @@ -186,11 +183,8 @@ public function serializeAmountType(XmlSerializationVisitor $visitor, $data, arr
*
* @param XmlSerializationVisitor $visitor
* @param mixed $data
* @param array $type
* @param Context $context
* @return DOMText|false
*/
public function serializeQuantityType(XmlSerializationVisitor $visitor, $data, array $type, Context $context)
public function serializeQuantityType(XmlSerializationVisitor $visitor, $data)
{
$node = $visitor->getDocument()->createTextNode(
number_format(
Expand All @@ -216,11 +210,8 @@ public function serializeQuantityType(XmlSerializationVisitor $visitor, $data, a
*
* @param XmlSerializationVisitor $visitor
* @param mixed $data
* @param array $type
* @param Context $context
* @return DOMText|false
*/
public function serializePercentType(XmlSerializationVisitor $visitor, $data, array $type, Context $context)
public function serializePercentType(XmlSerializationVisitor $visitor, $data)
{
$node = $visitor->getDocument()->createTextNode(
number_format(
Expand All @@ -241,11 +232,8 @@ public function serializePercentType(XmlSerializationVisitor $visitor, $data, ar
*
* @param XmlSerializationVisitor $visitor
* @param mixed $data
* @param array $type
* @param Context $context
* @return DOMElement|false
*/
public function serializeIndicatorType(XmlSerializationVisitor $visitor, $data, array $type, Context $context)
public function serializeIndicatorType(XmlSerializationVisitor $visitor, $data)
{
$node = $visitor->getDocument()->createElement('udt:Indicator', $data->getIndicator() == false ? 'false' : 'true');
return $node;
Expand Down
4 changes: 2 additions & 2 deletions src/quick/ZugferdQuickDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ public function doAddTradeAllowanceCharge(float $actualAmount, string $reason, s
*/
public function doAddApplicableTradeTax(float $basisAmount, float $percent, string $categoryCode, ?string $typeCode = null, ?float $allowanceChargeBasisAmount = null, ?string $exemptionReasonCode = null, ?string $exemptionReason = null): ZugferdQuickDescriptor
{
$this->addDocumentTax($categoryCode, $typeCode ?? "VAT", $basisAmount, round(0.01 * $percent * $basisAmount, 2), $percent, $exemptionReason, $exemptionReasonCode);
$this->addDocumentTax($categoryCode, $typeCode ?? "VAT", $basisAmount, round(0.01 * $percent * $basisAmount, 2), $percent, $exemptionReason, $exemptionReasonCode, null, $allowanceChargeBasisAmount);
return $this;
}

Expand Down Expand Up @@ -1012,7 +1012,7 @@ public function doAddApplicableTradeTax(float $basisAmount, float $percent, stri
*/
public function doAddApplicableTradeTax2(float $basisAmount, float $calculatedAmount, string $categoryCode, ?string $typeCode = null, ?float $allowanceChargeBasisAmount = null, ?string $exemptionReasonCode = null, ?string $exemptionReason = null): ZugferdQuickDescriptor
{
$this->addDocumentTax($categoryCode, $typeCode ?? "VAT", $basisAmount, $calculatedAmount, round($calculatedAmount * 100.0 / $basisAmount, 2), $exemptionReason, $exemptionReasonCode);
$this->addDocumentTax($categoryCode, $typeCode ?? "VAT", $basisAmount, $calculatedAmount, round($calculatedAmount * 100.0 / $basisAmount, 2), $exemptionReason, $exemptionReasonCode, null, $allowanceChargeBasisAmount);
return $this;
}

Expand Down
Loading

0 comments on commit 2381ea9

Please sign in to comment.