copy($this->rates[0]); $rate->deliveryMethod($deliveryMethod); $rate->firstItemRate->amount = $firstItemRate; $rate->nextItemRate->amount = $nextItemRate; $rate->maxQuantityPerPackage = $maxQuantityPerPackage; $this->ratesCollection[] = $rate; return $this; } /** * @return array */ public function jsonSerialize() { return array( 'id' => $this->id, 'name' => $this->name, 'rates' => $this->ratesCollection, 'lastModified' => $this->lastModified ); } }