protected function DryIcePlugin::verifyPackage in Commerce FedEx 8
Verified a package has all dry ic eor non-dry ice items.
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 is internally consistant.
Throws
\Exception If the provided $type is not of type 'string'.
1 call to DryIcePlugin::verifyPackage()
- DryIcePlugin::adjustPackage in modules/
dry_ice/ src/ Plugin/ Commerce/ FedEx/ DryIcePlugin.php - Adjust a package based on the items, shipment and profile.
File
- modules/
dry_ice/ src/ Plugin/ Commerce/ FedEx/ DryIcePlugin.php, line 218
Class
- DryIcePlugin
- Provides the Fedex Dry Ice Service.
Namespace
Drupal\commerce_fedex_dry_ice\Plugin\Commerce\FedExCode
protected function verifyPackage(array $shipment_items, $type) {
if (!is_string($type)) {
$varType = gettype($type);
throw new \Exception("Shipment type must be string. {$varType} given.");
}
$dryIceBox = $this
->isDryIceBox($shipment_items, $type);
foreach ($shipment_items as $shipment_item) {
if ($dryIceBox xor $this
->isDryIceItem($shipment_item, $type)) {
return FALSE;
}
}
return TRUE;
}