containerIdentifier = $containerIdentifier; $this->containerType = $containerType; } public function setDimensions(string $length, string $width, string $height, string $unitOfMeasure = 'CM') { $this->length = $length; $this->width = $width; $this->height = $height; $this->unitOfMeasure = $unitOfMeasure; } public function addItem( string $itemSequenceNumber, string $buyerProductIdentifier, string $vendorProductIdentifier, Quantity $packedQuantity ) { $quantity = $packedQuantity->toArray(); unset($quantity['unitSize']); $this->items[] = [ 'itemSequenceNumber' => (int)$itemSequenceNumber, 'buyerProductIdentifier' => $buyerProductIdentifier, 'vendorProductIdentifier' => $vendorProductIdentifier, 'packedQuantity' => $quantity, ]; } public function getItems(): array { return $this->items; } public function toArray() { return [ 'containerType' => $this->containerType, 'containerIdentifier' => $this->containerIdentifier, 'dimensions' => [ 'length' => $this->length, 'width' => $this->width, 'height' => $this->height, 'unitOfMeasure' => $this->unitOfMeasure, ], 'weight' => [ 'unitOfMeasure' => 'KG', 'value' => '1', ], 'packedItems' => $this->items, ]; } }