You are here

protected function DryIcePlugin::isDryIceBox in Commerce FedEx 8

Determine whether a droup of shipment items requires dry ice shipping.

Parameters

array $shipment_items: The shipment items to check.

string $type: The type, 'domestic' or 'intl' depending on the shipping distance.

Return value

bool True if the package needs dry ice shipping.

Throws

\Exception If the provided $type is not of type 'string'.

1 call to DryIcePlugin::isDryIceBox()
DryIcePlugin::verifyPackage in modules/dry_ice/src/Plugin/Commerce/FedEx/DryIcePlugin.php
Verified a package has all dry ic eor non-dry ice items.

File

modules/dry_ice/src/Plugin/Commerce/FedEx/DryIcePlugin.php, line 248

Class

DryIcePlugin
Provides the Fedex Dry Ice Service.

Namespace

Drupal\commerce_fedex_dry_ice\Plugin\Commerce\FedEx

Code

protected function isDryIceBox(array $shipment_items, $type) {
  if (!is_string($type)) {
    $varType = gettype($type);
    throw new \Exception("Shipment type must be string. {$varType} given.");
  }
  return $this
    ->isDryIceItem(reset($shipment_items), $type);
}