toArray(); if ($response['Response']['ResponseStatusCode'] != self::SUCCESS_NODE_VALUE) { $this->setIsSuccess(false)->setData([ 'errorCode' => $response['Response']['Error']['ErrorCode'], 'errorText' => $response['Response']['Error']['ErrorDescription'], ]); } else { $this->setIsSuccess()->setData([ 'serviceDetails' => $this->getServiceDetails(), 'ratedShipmentWarning' => $response['RatedShipment']['RatedShipmentWarning'], 'rate' => [ 'transportation' => $response['RatedShipment']['TransportationCharges']['MonetaryValue'], 'serviceOptions' => $response['RatedShipment']['ServiceOptionsCharges']['MonetaryValue'], 'total' => $response['RatedShipment']['TotalCharges']['MonetaryValue'], ], 'packageCount' => isset($response['RatedShipment']['RatedPackage'][0]) ? sizeof($response['RatedShipment']['RatedPackage']) : 1, ]); } return $this; } }