Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/mage-os/mirror-inventory
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
mage-os-ci committed Aug 29, 2024
2 parents 5fd3506 + 7dfeb07 commit 0941763
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
*/
public function execute(): string
{
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY));
$apiKey = trim((string) $this->scopeConfig->getValue(self::XML_PATH_API_KEY) ?? '');
if (!$apiKey) {
throw new LocalizedException(__('Google API key is not defined'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ private function getCountry(string $searchTerm): ?string
}
$searchTerm = explode($this->delimiterConfig->getDelimiter(), $searchTerm);

return trim(end($searchTerm));
return trim(end($searchTerm) ?? '');
}
}
8 changes: 6 additions & 2 deletions InventoryReservations/Model/ReservationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public function build(): ReservationInterface
}

/**
* Validate
*
* @return ValidationResult
*/
private function validate()
Expand All @@ -143,7 +145,7 @@ private function validate()
$errors[] = __('"%field" is expected to be a number.', ['field' => ReservationInterface::STOCK_ID]);
}

if (null === $this->sku || '' === trim($this->sku)) {
if (null === $this->sku || '' === trim($this->sku ?? '')) {
$errors[] = __('"%field" can not be empty.', ['field' => ReservationInterface::SKU]);
}

Expand All @@ -156,6 +158,7 @@ private function validate()

/**
* Used to clean state after object creation
*
* @return void
*/
private function reset()
Expand All @@ -168,7 +171,8 @@ private function reset()

/**
* Used to convert database field names (that use snake case) into constructor parameter names (that use camel case)
* to avoid to define them twice in domain model interface.
*
* To avoid to define them twice in domain model interface.
*
* @param array $array
* @return array
Expand Down

0 comments on commit 0941763

Please sign in to comment.