public function __construct($data) { $this->setId($data['id']); $recipient = new Recipient(); $recipient->setCompany($data['company_name']); $recipient->setCountry($data['address_state']); $recipient->setEmail($data['customer_email']); $recipient->setName($data['customer_name']); $recipient->setPhone($data['customer_phone']); $recipient->setStreet($data['address_street']); $recipient->setSurname($data['customer_surname']); $recipient->setTown($data['address_town']); $recipient->setZip($data['address_zip']); $this->setRecipient($recipient); $this->setOrderNumber($data['order_number']); $this->setPartnerConsignmentId($data['partner_consignment_id']); $this->setVariable($data['variable']); $this->setParcelCount($data['parcel_count']); $this->setCashOnDelivery($data['cash_on_delivery']); $this->setInsurance($data['insurance']); $this->setStatedPrice($data['stated_price']); $this->setCurrency($data['currency']); $this->setPassword($data['password']); $this->setRegisterBranchId($data['register_branch_id']); $this->setDestinationBranchId($data['destination_branch_id']); $timeCreated = $this->formatTime($data, 'time_created'); $this->setTimeCreated($timeCreated); $timeReceived = $this->formatTime($data, 'time_received'); $this->setTimeReceived($timeReceived); $this->setMaxStoringDate($data['max_storing_date']); $timeClosed = $this->formatTime($data, 'time_closed'); $this->setTimeClosed($timeClosed); $status = new Status($data['status']['id'], $data['status']['name']); $this->setStatus($status); $this->setParcelNumber($data['parcel_number']); $this->setWeight($data['weight']); $this->setRequireFullAge($data['require_full_age'] ? true : false); $this->setAllowCardPayment($data['allow_card_payment'] ? true : false); $this->setCardPaid($data['card_paid'] ? true : false); $this->setNote($data['note']); $timeUpdated = $this->formatTime($data, 'time_updated'); $this->setTimeUpdated($timeUpdated); $timeCodSent = $this->formatTime($data, 'time_cod_sent'); $this->setTimeCodSent($timeCodSent); $timeInvoiceSent = $this->formatTime($data, 'time_invoice_sent'); $this->setTimeInvoiceSent($timeInvoiceSent); $this->setTransportServiceId($data['transport_service_id']); $this->setMaxStoringDateIncreasedByClient($data['max_storing_date_increased_by_client'] ? true : false); $this->setMaxStoringDateIncreasedByPartner($data['max_storing_date_increased_by_partner'] ? true : false); }