コード例 #1
0
ファイル: Api.php プロジェクト: jaroslavlibal/api-v3
 /**
  * @param int $transportServiceId
  * @param string|null $shopId
  * @param bool $destinationOnly
  * @param bool $registerOnly
  * @param bool $includeInactive
  * @param string|null $destinationCountry ISO 3166-1 Alpha3
  *
  * @see TransportService for Transport Service ID's
  *
  * @return GetTransportServiceBranchesResponse
  */
 public function getTransportServiceBranches($transportServiceId, $shopId = null, $destinationOnly = false, $registerOnly = false, $includeInactive = false, $destinationCountry = null)
 {
     $resource = Resource::TRANSPORT_SERVICES . '/' . $transportServiceId . Resource::BRANCHES;
     $queryStringParams = [BranchAttr::QS_SHOP_ID => $shopId, BranchAttr::QS_DESTINATION_ONLY => $destinationOnly, BranchAttr::QS_REGISTER_ONLY => $registerOnly, BranchAttr::QS_INCLUDE_INACTIVE => $includeInactive, BranchAttr::QS_DESTINATION_COUNTRY => $destinationCountry];
     $queryString = http_build_query($queryStringParams);
     if (mb_strlen($queryString) > 0) {
         $resource .= '?' . $queryString;
     }
     $requestEnvelope = new RequestEnvelope(null, $resource, Method::GET);
     $requestEnvelopeWithHeaders = $this->attachBasicHeadersToRequest($requestEnvelope);
     $connectorResponse = $this->connector->sendRequest($requestEnvelopeWithHeaders);
     $formattedResponse = $this->formatter->formatGetTransportServiceBranchesResponse($connectorResponse);
     return $formattedResponse;
 }