Skip to content

Commit

Permalink
feat: add international bbp
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen committed Mar 14, 2024
1 parent a446ca5 commit f096fe7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
20 changes: 16 additions & 4 deletions src/Model/Account/CarrierOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,24 @@ class CarrierOptions extends BaseModel
*/
private $optional;

/**
* @var int
*/
private $contractId;

/**
* @param array $options
*
* @throws \Exception
*/
public function __construct(array $options)
{
$this->enabled = (bool) $options['enabled'];
$this->optional = (bool) $options['optional'];
$this->carrier = CarrierFactory::create($options['carrier']['id']);
$this->label = $options['label'] ?? $this->carrier->getHuman();
var_dump($options); echo "\njoepiejoepie\n";

Check notice on line 45 in src/Model/Account/CarrierOptions.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Model/Account/CarrierOptions.php#L45

Each PHP statement must be on a line by itself
$this->enabled = (bool) $options['enabled'];
$this->optional = (bool) $options['optional'];
$this->carrier = CarrierFactory::create($options['carrier']['id']);
$this->label = $options['label'] ?? $this->carrier->getHuman();
$this->contractId = $options['subscription_id'] ?? null;
}

/**
Expand Down Expand Up @@ -74,4 +81,9 @@ public function isOptional(): bool
{
return $this->optional;
}

public function hasContract(): bool
{
return (bool) $this->contractId;
}
}
7 changes: 0 additions & 7 deletions src/Model/Consignment/PostNLConsignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ public function getAllowedExtraOptions(): array
*/
public function getAllowedPackageTypes(): array
{
$cc = $this->getCountry() ?? $this->getLocalCountryCode();
if ($cc !== $this->getLocalCountryCode()) {
return [
self::PACKAGE_TYPE_PACKAGE_NAME,
self::PACKAGE_TYPE_MAILBOX_NAME,
];
}
return [
self::PACKAGE_TYPE_PACKAGE_NAME,
self::PACKAGE_TYPE_MAILBOX_NAME,
Expand Down

0 comments on commit f096fe7

Please sign in to comment.