You are here

public function DangerousGoodsPlugin::splitPackage in Commerce FedEx 8

Function splitPackage.

Parameters

array $shipment_items: An Array of shipment items.

\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The Shipment.

Return value

array An array of arrays of shipment items.

Overrides FedExPluginBase::splitPackage

File

modules/dangerous/src/Plugin/Commerce/FedEx/DangerousGoodsPlugin.php, line 86

Class

DangerousGoodsPlugin
Providex the FedEx Dangerous Goods Service Plugin.

Namespace

Drupal\commerce_fedex_dangerous\Plugin\Commerce\FedEx

Code

public function splitPackage(array $shipment_items, ShipmentInterface $shipment) {
  $packages = [];
  foreach ($shipment_items as $shipment_item) {
    $packages[$this
      ->getDangerousStatus($shipment_item)][] = $shipment_item;
  }
  return array_values($packages);
}