Skip to content

Commit

Permalink
Merge pull request #379 from myparcelnl/company-can-be-empty
Browse files Browse the repository at this point in the history
add const and company can be empty
  • Loading branch information
RichardPerdaan authored Mar 23, 2020
2 parents 54da3ec + cd7989a commit 74cb049
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions Model/Source/DefaultOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

class DefaultOptions
{
// Maximum characters length of company name.
const COMPANY_NAME_MAX_LENGTH = 50;

/**
* @var Data
*/
Expand Down Expand Up @@ -79,19 +82,19 @@ public function getDefault($option)
}

/**
* @param $address
* @param string|null $address
*
* @return string
* @return string|null
*/
public function getMaxCompanyName(string $address): string
public function getMaxCompanyName(?string $address): ?string
{
if (strlen($address) >= self::COMPANY_NAME_MAX_LENGTH) {
if (strlen((string) $address) >= self::COMPANY_NAME_MAX_LENGTH) {
$address = substr($address, 0, 47) . '...';
}

return $address;
}

/**
* Get default value of insurance based on order grand total
*
Expand Down Expand Up @@ -158,7 +161,7 @@ private function isDigitalStampOrMailbox($option) {
) {
return true;
}

return false;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "myparcelnl/magento",
"description": "A Magento 2 module that creates MyParcel labels",
"type": "magento2-module",
"version": "2.5.6",
"version": "2.5.8",
"homepage": "https://www.myparcel.nl",
"keywords": ["MyParcel", "My Parcel", "Post NL", "PostNL", "Magento 2"],
"license": "GPL-3.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd" >
<module name="MyParcelNL_Magento" setup_version="2.5.3">
<module name="MyParcelNL_Magento" setup_version="2.5.8">
<sequence>
<module name="Magento_Sales"/>
</sequence>
Expand Down

0 comments on commit 74cb049

Please sign in to comment.