Skip to content

Commit

Permalink
refactured RequestType to MarketplaceWebService_RequestType fpr PSR-0…
Browse files Browse the repository at this point in the history
… compatibility
  • Loading branch information
Nikolas Hermann committed Dec 12, 2014
1 parent 9fc2f6c commit cafc04b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/MarketplaceWebService/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ private function performRequest($action, array $converted, $dataHandle = null, $
$code = (int) curl_getinfo($this->curlClient, CURLINFO_HTTP_CODE);

// Only attempt to verify the Content-MD5 value if the request was successful.
if (RequestType::getRequestType($action) === RequestType::POST_DOWNLOAD) {
if (MarketplaceWebService_RequestType::getRequestType($action) === MarketplaceWebService_RequestType::POST_DOWNLOAD) {
if ($code != 200) {
rewind($this->errorResponseBody);
$httpResponse = stream_get_contents($this->errorResponseBody);
Expand Down Expand Up @@ -956,7 +956,7 @@ private function parseHttpHeader($header) {

/**
* cURL callback to write the response HTTP body into a stream. This is only intended to be used
* with RequestType::POST_DOWNLOAD request types, since the responses can potentially become
* with MarketplaceWebService_RequestType::POST_DOWNLOAD request types, since the responses can potentially become
* large.
*
* @param $ch - The curl handle.
Expand Down Expand Up @@ -1031,9 +1031,9 @@ private function configureCurlOptions($action, array $converted, $streamHandle =
$serviceUrl .= '/';
}

$requestType = RequestType::getRequestType($action);
$requestType = MarketplaceWebService_RequestType::getRequestType($action);

if ($requestType == RequestType::POST_UPLOAD) {
if ($requestType == MarketplaceWebService_RequestType::POST_UPLOAD) {

if (is_null($streamHandle) || !is_resource($streamHandle)) {
throw new MarketplaceWebService_Exception(
Expand All @@ -1058,11 +1058,11 @@ private function configureCurlOptions($action, array $converted, $streamHandle =

$curlOptions[CURLOPT_CUSTOMREQUEST] = self::REQUEST_TYPE;

} else if (!($requestType === RequestType::UNKNOWN)) {
} else if (!($requestType === MarketplaceWebService_RequestType::UNKNOWN)) {
$curlOptions[CURLOPT_URL] = $this->config['ServiceURL'];
$curlOptions[CURLOPT_POSTFIELDS] = $this->getParametersAsString($converted[CONVERTED_PARAMETERS_KEY]);

if ($requestType == RequestType::POST_DOWNLOAD) {
if ($requestType == MarketplaceWebService_RequestType::POST_DOWNLOAD) {
$this->responseBodyContents = $streamHandle;
$curlOptions[CURLOPT_WRITEFUNCTION] = array ($this, 'responseCallback');
}
Expand All @@ -1074,7 +1074,7 @@ private function configureCurlOptions($action, array $converted, $streamHandle =
}

/**
* For RequestType::POST_DOWNLOAD actions, construct a response containing the Amazon Request ID
* For MarketplaceWebService_RequestType::POST_DOWNLOAD actions, construct a response containing the Amazon Request ID
* and Content MD5 header value.
*
* @param $responseType
Expand Down
2 changes: 1 addition & 1 deletion src/MarketplaceWebService/RequestType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* matching the request type.
* 3. 'Regular' POST requests. This represents the multitude of MWS requests.
*/
final class RequestType {
final class MarketplaceWebService_RequestType {
const POST_UPLOAD = 'POST_UPLOAD';
const POST_DOWNLOAD = 'POST_DOWNLOAD';
const POST_DEFAULT = 'POST_DEFAULT';
Expand Down

0 comments on commit cafc04b

Please sign in to comment.