public function build() { Verify::verifyArrayNonEmpty($this->items, 'items'); Verify::verifyArrayNonEmpty($this->total, 'total'); return array('total' => (object) $this->total, 'items' => array_map(function (CheckoutItem $item) { return $item->build(); }, $this->items)); }
public function build() { Verify::verifyIntRange($this->count, 'count', 1); Verify::verifyStringNonEmpty($this->sku, 'sku'); Verify::verifyArrayNonEmpty($this->price, 'price'); Verify::verifyArrayNonEmpty($this->name, 'name'); return array('count' => $this->count, 'name' => (object) $this->name, 'sku' => $this->sku, 'external_id' => $this->externalId, 'price' => (object) $this->price); }