repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.setStatusFilter | public function setStatusFilter($s){
if (is_string($s)){
$this->resetStatusFilter();
$this->options['ShipmentStatusList.member.1'] = $s;
} else if (is_array($s)){
$this->resetStatusFilter();
$i = 1;
foreach($s as $x){
$this->options['ShipmentStatusList.member.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setStatusFilter($s){
if (is_string($s)){
$this->resetStatusFilter();
$this->options['ShipmentStatusList.member.1'] = $s;
} else if (is_array($s)){
$this->resetStatusFilter();
$i = 1;
foreach($s as $x){
$this->options['ShipmentStatusList.member.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setStatusFilter",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetStatusFilter",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'ShipmentStatusList.member.1'",
"]",
"=",
... | sets the status filter to be used in the next request. (Required*)
This method sets the list of seller SKUs to be sent in the next request.
Setting this parameter tells Amazon to only return shipments with statuses
that match those in the list. This parameter is required if the Shipment ID filter
is not used. Below is a list of valid statuses:
<ul>
<li>WORKING</li>
<li>SHIPPED</li>
<li>IN_TRANSIT</li>
<li>DELIVERED</li>
<li>CHECKED_IN</li>
<li>RECEIVING</li>
<li>CLOSED</li>
<li>CANCELLED</li>
<li>DELETED</li>
<li>ERROR</li>
</ul>
@param array|string $s <p>A list of statuses, or a single status string.</p>
@return boolean <b>FALSE</b> if improper input | [
"sets",
"the",
"status",
"filter",
"to",
"be",
"used",
"in",
"the",
"next",
"request",
".",
"(",
"Required",
"*",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L98-L112 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.resetStatusFilter | protected function resetStatusFilter(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentStatusList#",$op)){
unset($this->options[$op]);
}
}
} | php | protected function resetStatusFilter(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentStatusList#",$op)){
unset($this->options[$op]);
}
}
} | [
"protected",
"function",
"resetStatusFilter",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ShipmentStatusList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"... | Resets the status options.
Since status is a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"status",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L120-L126 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.setIdFilter | public function setIdFilter($s){
if (is_string($s)){
$this->resetIdFilter();
$this->options['ShipmentIdList.member.1'] = $s;
} else if (is_array($s)){
$this->resetIdFilter();
$i = 1;
foreach($s as $x){
$this->options['ShipmentIdList.member.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setIdFilter($s){
if (is_string($s)){
$this->resetIdFilter();
$this->options['ShipmentIdList.member.1'] = $s;
} else if (is_array($s)){
$this->resetIdFilter();
$i = 1;
foreach($s as $x){
$this->options['ShipmentIdList.member.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setIdFilter",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetIdFilter",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'ShipmentIdList.member.1'",
"]",
"=",
"$",
"s",... | Sets the shipment ID(s). (Required*)
This method sets the list of Shipment IDs to be sent in the next request.
Setting this parameter tells Amazon to only return Shipments that match
the IDs in the list. This parameter is required if the Shipment Status filter
is not used.
@param array|string $s <p>A list of Feed Submission IDs, or a single ID string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"shipment",
"ID",
"(",
"s",
")",
".",
"(",
"Required",
"*",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L138-L152 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.resetIdFilter | protected function resetIdFilter(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentIdList#",$op)){
unset($this->options[$op]);
}
}
} | php | protected function resetIdFilter(){
foreach($this->options as $op=>$junk){
if(preg_match("#ShipmentIdList#",$op)){
unset($this->options[$op]);
}
}
} | [
"protected",
"function",
"resetIdFilter",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ShipmentIdList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"(",
"$... | Resets the shipment ID options.
Since shipment ID is a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"shipment",
"ID",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L160-L166 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.setTimeLimits | public function setTimeLimits($lower = null, $upper = null){
try{
if ($lower){
$after = $this->genTime($lower);
} else {
$after = $this->genTime('- 2 min');
}
if ($upper){
$before = $this->genTime($upper);
} else {
$before = $this->genTime('- 2 min');
}
$this->options['LastUpdatedAfter'] = $after;
$this->options['LastUpdatedBefore'] = $before;
if (isset($this->options['LastUpdatedAfter']) &&
isset($this->options['LastUpdatedBefore']) &&
$this->options['LastUpdatedAfter'] > $this->options['LastUpdatedBefore']){
$this->setTimeLimits($this->options['LastUpdatedBefore'].' - 1 second',$this->options['LastUpdatedBefore']);
}
} catch (Exception $e){
throw new InvalidArgumentException('Parameters should be timestamps.');
}
} | php | public function setTimeLimits($lower = null, $upper = null){
try{
if ($lower){
$after = $this->genTime($lower);
} else {
$after = $this->genTime('- 2 min');
}
if ($upper){
$before = $this->genTime($upper);
} else {
$before = $this->genTime('- 2 min');
}
$this->options['LastUpdatedAfter'] = $after;
$this->options['LastUpdatedBefore'] = $before;
if (isset($this->options['LastUpdatedAfter']) &&
isset($this->options['LastUpdatedBefore']) &&
$this->options['LastUpdatedAfter'] > $this->options['LastUpdatedBefore']){
$this->setTimeLimits($this->options['LastUpdatedBefore'].' - 1 second',$this->options['LastUpdatedBefore']);
}
} catch (Exception $e){
throw new InvalidArgumentException('Parameters should be timestamps.');
}
} | [
"public",
"function",
"setTimeLimits",
"(",
"$",
"lower",
"=",
"null",
",",
"$",
"upper",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"lower",
")",
"{",
"$",
"after",
"=",
"$",
"this",
"->",
"genTime",
"(",
"$",
"lower",
")",
";",
"}",
"... | Sets the time frame filter for the shipments fetched. (Optional)
If no times are specified, times default to the current time.
@param dateTime $lower <p>Date the order was created after, is passed through strtotime</p>
@param dateTime $upper <p>Date the order was created before, is passed through strtotime</p>
@throws InvalidArgumentException | [
"Sets",
"the",
"time",
"frame",
"filter",
"for",
"the",
"shipments",
"fetched",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L176-L200 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.prepareToken | protected function prepareToken(){
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'ListInboundShipmentsByNextToken';
} else {
unset($this->options['NextToken']);
$this->options['Action'] = 'ListInboundShipments';
$this->index = 0;
$this->shipmentList = array();
}
} | php | protected function prepareToken(){
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'ListInboundShipmentsByNextToken';
} else {
unset($this->options['NextToken']);
$this->options['Action'] = 'ListInboundShipments';
$this->index = 0;
$this->shipmentList = array();
}
} | [
"protected",
"function",
"prepareToken",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokenFlag",
"&&",
"$",
"this",
"->",
"tokenUseFlag",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
"=",
"'ListInboundShipmentsByNextToken'",
";",
"}",
"e... | Sets up options for using tokens.
This changes key options for switching between simply fetching a list and
fetching the rest of a list using a token. Please note: because the
operation for using tokens does not use any other parameters, all other
parameters will be removed. | [
"Sets",
"up",
"options",
"for",
"using",
"tokens",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L271-L280 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.parseXML | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->ShipmentData->children() as $x){
$a = array();
if (isset($x->ShipmentId)){
$a['ShipmentId'] = (string)$x->ShipmentId;
}
if (isset($x->ShipmentName)){
$a['ShipmentName'] = (string)$x->ShipmentName;
}
//Address
$a['ShipFromAddress']['Name'] = (string)$x->ShipFromAddress->Name;
$a['ShipFromAddress']['AddressLine1'] = (string)$x->ShipFromAddress->AddressLine1;
if (isset($x->ShipFromAddress->AddressLine2)){
$a['ShipFromAddress']['AddressLine2'] = (string)$x->ShipFromAddress->AddressLine2;
} else {
$a['ShipFromAddress']['AddressLine2'] = null;
}
$a['ShipFromAddress']['City'] = (string)$x->ShipFromAddress->City;
if (isset($x->ShipFromAddress->DistrictOrCounty)){
$a['ShipFromAddress']['DistrictOrCounty'] = (string)$x->ShipFromAddress->DistrictOrCounty;
} else {
$a['ShipFromAddress']['DistrictOrCounty'] = null;
}
$a['ShipFromAddress']['StateOrProvinceCode'] = (string)$x->ShipFromAddress->StateOrProvinceCode;
$a['ShipFromAddress']['CountryCode'] = (string)$x->ShipFromAddress->CountryCode;
$a['ShipFromAddress']['PostalCode'] = (string)$x->ShipFromAddress->PostalCode;
if (isset($x->DestinationFulfillmentCenterId)){
$a['DestinationFulfillmentCenterId'] = (string)$x->DestinationFulfillmentCenterId;
}
if (isset($x->LabelPrepType)){
$a['LabelPrepType'] = (string)$x->LabelPrepType;
}
if (isset($x->ShipmentStatus)){
$a['ShipmentStatus'] = (string)$x->ShipmentStatus;
}
$a['AreCasesRequired'] = (string)$x->AreCasesRequired;
if (isset($x->ConfirmedNeedByDate)){
$a['ConfirmedNeedByDate'] = (string)$x->ConfirmedNeedByDate;
}
$this->shipmentList[$this->index] = $a;
$this->index++;
}
} | php | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->ShipmentData->children() as $x){
$a = array();
if (isset($x->ShipmentId)){
$a['ShipmentId'] = (string)$x->ShipmentId;
}
if (isset($x->ShipmentName)){
$a['ShipmentName'] = (string)$x->ShipmentName;
}
//Address
$a['ShipFromAddress']['Name'] = (string)$x->ShipFromAddress->Name;
$a['ShipFromAddress']['AddressLine1'] = (string)$x->ShipFromAddress->AddressLine1;
if (isset($x->ShipFromAddress->AddressLine2)){
$a['ShipFromAddress']['AddressLine2'] = (string)$x->ShipFromAddress->AddressLine2;
} else {
$a['ShipFromAddress']['AddressLine2'] = null;
}
$a['ShipFromAddress']['City'] = (string)$x->ShipFromAddress->City;
if (isset($x->ShipFromAddress->DistrictOrCounty)){
$a['ShipFromAddress']['DistrictOrCounty'] = (string)$x->ShipFromAddress->DistrictOrCounty;
} else {
$a['ShipFromAddress']['DistrictOrCounty'] = null;
}
$a['ShipFromAddress']['StateOrProvinceCode'] = (string)$x->ShipFromAddress->StateOrProvinceCode;
$a['ShipFromAddress']['CountryCode'] = (string)$x->ShipFromAddress->CountryCode;
$a['ShipFromAddress']['PostalCode'] = (string)$x->ShipFromAddress->PostalCode;
if (isset($x->DestinationFulfillmentCenterId)){
$a['DestinationFulfillmentCenterId'] = (string)$x->DestinationFulfillmentCenterId;
}
if (isset($x->LabelPrepType)){
$a['LabelPrepType'] = (string)$x->LabelPrepType;
}
if (isset($x->ShipmentStatus)){
$a['ShipmentStatus'] = (string)$x->ShipmentStatus;
}
$a['AreCasesRequired'] = (string)$x->AreCasesRequired;
if (isset($x->ConfirmedNeedByDate)){
$a['ConfirmedNeedByDate'] = (string)$x->ConfirmedNeedByDate;
}
$this->shipmentList[$this->index] = $a;
$this->index++;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"xml",
"->",
"ShipmentData",
"->",
"children",
"(",
")",
"as",
"$",
"x",
")",
"{",
"$",
"a",
... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L289-L340 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.fetchItems | public function fetchItems($i = null, $token = false){
if (!isset($this->shipmentList)){
return false;
}
if (is_null($i)){
$a = array();
$n = 0;
foreach($this->shipmentList as $x){
$a[$n] = new AmazonShipmentItemList($this->storeName,$x['ShipmentId'],$this->mockMode,$this->mockFiles,$this->config);
$a[$n]->setUseToken($token);
$a[$n]->mockIndex = $this->mockIndex;
$a[$n]->fetchItems();
$n++;
}
return $a;
} else if (is_int($i)) {
$temp = new AmazonShipmentItemList($this->storeName,$this->shipmentList[$i]['ShipmentId'],$this->mockMode,$this->mockFiles,$this->config);
$temp->setUseToken($token);
$temp->mockIndex = $this->mockIndex;
$temp->fetchItems();
return $temp;
} else {
return false;
}
} | php | public function fetchItems($i = null, $token = false){
if (!isset($this->shipmentList)){
return false;
}
if (is_null($i)){
$a = array();
$n = 0;
foreach($this->shipmentList as $x){
$a[$n] = new AmazonShipmentItemList($this->storeName,$x['ShipmentId'],$this->mockMode,$this->mockFiles,$this->config);
$a[$n]->setUseToken($token);
$a[$n]->mockIndex = $this->mockIndex;
$a[$n]->fetchItems();
$n++;
}
return $a;
} else if (is_int($i)) {
$temp = new AmazonShipmentItemList($this->storeName,$this->shipmentList[$i]['ShipmentId'],$this->mockMode,$this->mockFiles,$this->config);
$temp->setUseToken($token);
$temp->mockIndex = $this->mockIndex;
$temp->fetchItems();
return $temp;
} else {
return false;
}
} | [
"public",
"function",
"fetchItems",
"(",
"$",
"i",
"=",
"null",
",",
"$",
"token",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_null",
"(",
"$"... | Returns array of item lists or a single item list.
If <i>$i</i> is not specified, the method will fetch the items for every
shipment in the list. Please note that for lists with a high number of shipments,
this operation could take a while due to throttling. (Two seconds per order when throttled.)
@param int $i [optional] <p>List index to retrieve the value from. Defaults to null.</p>
@param boolean $token [optional] <p>whether or not to automatically use tokens when fetching items.</p>
@return array|AmazonShipmentItemList <i>AmazonShipmentItemList</i> object or array of objects, or <b>FALSE</b> if non-numeric index | [
"Returns",
"array",
"of",
"item",
"lists",
"or",
"a",
"single",
"item",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L352-L376 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getShipmentId | public function getShipmentId($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentId'];
} else {
return false;
}
} | php | public function getShipmentId($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentId'];
} else {
return false;
}
} | [
"public",
"function",
"getShipmentId",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the shipment ID for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"shipment",
"ID",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L385-L394 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getShipmentName | public function getShipmentName($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentName'];
} else {
return false;
}
} | php | public function getShipmentName($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentName'];
} else {
return false;
}
} | [
"public",
"function",
"getShipmentName",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the name for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"name",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L403-L412 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getAddress | public function getAddress($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipFromAddress'];
} else {
return false;
}
} | php | public function getAddress($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipFromAddress'];
} else {
return false;
}
} | [
"public",
"function",
"getAddress",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the shipping address for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
The returned array will have the following fields:
<ul>
<li><b>Name</b></li>
<li><b>AddressLine1</b></li>
<li><b>AddressLine2</b> (optional)</li>
<li><b>City</b></li>
<li><b>DistrictOrCounty</b> (optional)</li>
<li><b>StateOrProvinceCode</b> (optional)</li>
<li><b>CountryCode</b></li>
<li><b>PostalCode</b></li>
</ul>
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return array|boolean array, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"shipping",
"address",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L432-L441 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getDestinationFulfillmentCenterId | public function getDestinationFulfillmentCenterId($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['DestinationFulfillmentCenterId'];
} else {
return false;
}
} | php | public function getDestinationFulfillmentCenterId($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['DestinationFulfillmentCenterId'];
} else {
return false;
}
} | [
"public",
"function",
"getDestinationFulfillmentCenterId",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
... | Returns the Destination Fulfillment Center ID for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"Destination",
"Fulfillment",
"Center",
"ID",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L450-L459 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getLabelPrepType | public function getLabelPrepType($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['LabelPrepType'];
} else {
return false;
}
} | php | public function getLabelPrepType($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['LabelPrepType'];
} else {
return false;
}
} | [
"public",
"function",
"getLabelPrepType",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",... | Returns the label prep type for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"label",
"prep",
"type",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L468-L477 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getShipmentStatus | public function getShipmentStatus($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentStatus'];
} else {
return false;
}
} | php | public function getShipmentStatus($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ShipmentStatus'];
} else {
return false;
}
} | [
"public",
"function",
"getShipmentStatus",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return"... | Returns the shipment status for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"shipment",
"status",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L486-L495 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getIfCasesRequired | public function getIfCasesRequired($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['AreCasesRequired'];
} else {
return false;
}
} | php | public function getIfCasesRequired($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['AreCasesRequired'];
} else {
return false;
}
} | [
"public",
"function",
"getIfCasesRequired",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return... | Returns whether or not cases are required for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean "true" or "false", or <b>FALSE</b> if Non-numeric index | [
"Returns",
"whether",
"or",
"not",
"cases",
"are",
"required",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L504-L513 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getConfirmedNeedByDate | public function getConfirmedNeedByDate($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ConfirmedNeedByDate'];
} else {
return false;
}
} | php | public function getConfirmedNeedByDate($i = 0){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i]['ConfirmedNeedByDate'];
} else {
return false;
}
} | [
"public",
"function",
"getConfirmedNeedByDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"re... | Returns the maximum arrival date for the specified shipment.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean Date in YYYY-MM-DD format, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"maximum",
"arrival",
"date",
"for",
"the",
"specified",
"shipment",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L522-L531 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentList.php | AmazonShipmentList.getShipment | public function getShipment($i = null){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i];
} else {
return $this->shipmentList;
}
} | php | public function getShipment($i = null){
if (!isset($this->shipmentList)){
return false;
}
if (is_int($i)){
return $this->shipmentList[$i];
} else {
return $this->shipmentList;
}
} | [
"public",
"function",
"getShipment",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"shipmentList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the full list.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single shipment will have the following fields:
<ul>
<li><b>ShipmentId</b> (optional)</li>
<li><b>ShipmentName</b> (optional)</li>
<li><b>ShipFromAddress</b> (see <i>getAddress</i> for details)</li>
<li><b>DestinationFulfillmentCenterId</b> (optional)</li>
<li><b>LabelPrepType</b> (optional)</li>
<li><b>ShipmentStatus</b> (optional)</li>
<li><b>AreCasesRequired</b></li>
</ul>
@param int $i [optional] <p>List index of the report to return. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"full",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentList.php#L550-L559 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReport.php | AmazonReport.fetchReport | public function fetchReport(){
if (!array_key_exists('ReportId',$this->options)){
$this->log("Report ID must be set in order to fetch it!",'Warning');
return false;
}
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
if ($this->mockMode){
$this->rawreport = $this->fetchMockFile(false);
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$this->rawreport = $response['body'];
}
} | php | public function fetchReport(){
if (!array_key_exists('ReportId',$this->options)){
$this->log("Report ID must be set in order to fetch it!",'Warning');
return false;
}
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
if ($this->mockMode){
$this->rawreport = $this->fetchMockFile(false);
} else {
$response = $this->sendRequest($url, array('Post'=>$query));
if (!$this->checkResponse($response)){
return false;
}
$this->rawreport = $response['body'];
}
} | [
"public",
"function",
"fetchReport",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'ReportId'",
",",
"$",
"this",
"->",
"options",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Report ID must be set in order to fetch it!\"",
",",
"'Warning'",
")"... | Sends a request to Amazon for a report.
Submits a <i>GetReport</i> request to Amazon. In order to do this,
a report ID is required. Amazon will send
the data back as a response, which can be saved using <i>saveReport</i>.
@return boolean <b>FALSE</b> if something goes wrong | [
"Sends",
"a",
"request",
"to",
"Amazon",
"for",
"a",
"report",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReport.php#L87-L109 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReport.php | AmazonReport.saveReport | public function saveReport($path){
if (!isset($this->rawreport)){
return false;
}
try{
file_put_contents($path, $this->rawreport);
$this->log("Successfully saved report #".$this->options['ReportId']." at $path");
} catch (Exception $e){
$this->log("Unable to save report #".$this->options['ReportId']." at $path: $e",'Urgent');
return false;
}
} | php | public function saveReport($path){
if (!isset($this->rawreport)){
return false;
}
try{
file_put_contents($path, $this->rawreport);
$this->log("Successfully saved report #".$this->options['ReportId']." at $path");
} catch (Exception $e){
$this->log("Unable to save report #".$this->options['ReportId']." at $path: $e",'Urgent');
return false;
}
} | [
"public",
"function",
"saveReport",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"rawreport",
")",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"file_put_contents",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"ra... | Saves the raw report data to a path you specify
@param string $path <p>filename to save the file in</p>
@return boolean <b>FALSE</b> if something goes wrong | [
"Saves",
"the",
"raw",
"report",
"data",
"to",
"a",
"path",
"you",
"specify"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReport.php#L130-L141 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.setMock | public function setMock($b = true,$files = null){
if (is_bool($b)){
$this->resetMock(true);
$this->mockMode = $b;
if ($b){
$this->log("Mock Mode set to ON");
}
if (is_string($files)){
$this->mockFiles = array();
$this->mockFiles[0] = $files;
$this->log("Single Mock File set: $files");
} else if (is_array($files)){
$this->mockFiles = $files;
$this->log("Mock files array set.");
} else if (is_numeric($files)){
$this->mockFiles = array();
$this->mockFiles[0] = $files;
$this->log("Single Mock Response set: $files");
}
}
} | php | public function setMock($b = true,$files = null){
if (is_bool($b)){
$this->resetMock(true);
$this->mockMode = $b;
if ($b){
$this->log("Mock Mode set to ON");
}
if (is_string($files)){
$this->mockFiles = array();
$this->mockFiles[0] = $files;
$this->log("Single Mock File set: $files");
} else if (is_array($files)){
$this->mockFiles = $files;
$this->log("Mock files array set.");
} else if (is_numeric($files)){
$this->mockFiles = array();
$this->mockFiles[0] = $files;
$this->log("Single Mock Response set: $files");
}
}
} | [
"public",
"function",
"setMock",
"(",
"$",
"b",
"=",
"true",
",",
"$",
"files",
"=",
"null",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"b",
")",
")",
"{",
"$",
"this",
"->",
"resetMock",
"(",
"true",
")",
";",
"$",
"this",
"->",
"mockMode",
"="... | Enables or disables Mock Mode for the object.
Use this method when you want to test your object without sending
actual requests to Amazon. When Mock Mode is enabled, responses are
pulled from files you specify instead of sending the request.
Be careful, as this means that the parameters you send will not
necessarily match the response you get back. The files are pulled in order
of the list, looping back to the first file after the last file is used.
The log records every time a file is set or used, or if the file is missing.
This method is also used to set response codes used by certain functions.
Mock Mode is particularly useful when you need
to test functions such as canceling orders or adding new products.
@param boolean $b [optional] <p>When set to <b>TRUE</b>, Mock Mode is
enabled for the object. Defaults to <b>TRUE</b>.</p>
@param array|string|integer $files [optional] <p>The list of files (or single file)
to be used with Mock Mode. If a single string is given, this method will
put it into an array. Integers can also be given, for use in <i>fetchMockResponse</i>.
These numbers should only be response codes, such as <b>200</b> or <b>404</b>.</p> | [
"Enables",
"or",
"disables",
"Mock",
"Mode",
"for",
"the",
"object",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L162-L183 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.fetchMockFile | protected function fetchMockFile($load = true){
if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
$this->log("Attempted to retrieve mock files, but no mock files present",'Warning');
return false;
}
if(!array_key_exists($this->mockIndex, $this->mockFiles)){
$this->log("End of Mock List, resetting to 0");
$this->resetMock();
}
//check for absolute/relative file paths
if (strpos($this->mockFiles[$this->mockIndex], '/') === 0 || strpos($this->mockFiles[$this->mockIndex], '..') === 0){
$url = $this->mockFiles[$this->mockIndex];
} else {
$url = 'mock/'.$this->mockFiles[$this->mockIndex];
}
$this->mockIndex++;
if(file_exists($url)){
try{
$this->log("Fetched Mock File: $url");
if ($load){
$return = simplexml_load_file($url);
} else {
$return = file_get_contents($url);
}
return $return;
} catch (Exception $e){
$this->log("Error when opening Mock File: $url - ".$e->getMessage(),'Warning');
return false;
}
} else {
$this->log("Mock File not found: $url",'Warning');
return false;
}
} | php | protected function fetchMockFile($load = true){
if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
$this->log("Attempted to retrieve mock files, but no mock files present",'Warning');
return false;
}
if(!array_key_exists($this->mockIndex, $this->mockFiles)){
$this->log("End of Mock List, resetting to 0");
$this->resetMock();
}
//check for absolute/relative file paths
if (strpos($this->mockFiles[$this->mockIndex], '/') === 0 || strpos($this->mockFiles[$this->mockIndex], '..') === 0){
$url = $this->mockFiles[$this->mockIndex];
} else {
$url = 'mock/'.$this->mockFiles[$this->mockIndex];
}
$this->mockIndex++;
if(file_exists($url)){
try{
$this->log("Fetched Mock File: $url");
if ($load){
$return = simplexml_load_file($url);
} else {
$return = file_get_contents($url);
}
return $return;
} catch (Exception $e){
$this->log("Error when opening Mock File: $url - ".$e->getMessage(),'Warning');
return false;
}
} else {
$this->log("Mock File not found: $url",'Warning');
return false;
}
} | [
"protected",
"function",
"fetchMockFile",
"(",
"$",
"load",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"mockFiles",
")",
"||",
"!",
"array_key_exists",
"(",
"0",
",",
"$",
"this",
"->",
"mockFiles",
")",
")",
"{",
"$",... | Fetches the given mock file, or attempts to.
This method is only called when Mock Mode is enabled. This is where
files from the mock file list are retrieved and passed back to the caller.
The success or failure of the operation will be recorded in the log,
including the name and path of the file involved. For retrieving response
codes, see <i>fetchMockResponse</i>.
@param boolean $load [optional] <p>Set this to <b>FALSE</b> to prevent the
method from loading the file's contents into a SimpleXMLElement. This is
for when the contents of the file are not in XML format, or if you simply
want to retrieve the raw string of the file.</p>
@return SimpleXMLElement|string|boolean <p>A SimpleXMLElement holding the
contents of the file, or a string of said contents if <i>$load</i> is set to
<b>FALSE</b>. The return will be <b>FALSE</b> if the file cannot be
fetched for any reason.</p> | [
"Fetches",
"the",
"given",
"mock",
"file",
"or",
"attempts",
"to",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L202-L240 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.fetchMockResponse | protected function fetchMockResponse(){
if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
$this->log("Attempted to retrieve mock responses, but no mock responses present",'Warning');
return false;
}
if(!array_key_exists($this->mockIndex, $this->mockFiles)){
$this->log("End of Mock List, resetting to 0");
$this->resetMock();
}
if (!is_numeric($this->mockFiles[$this->mockIndex])){
$this->log("fetchMockResponse only works with response code numbers",'Warning');
return false;
}
$r = array();
$r['head'] = 'HTTP/1.1 200 OK';
$r['body'] = '<?xml version="1.0"?><root></root>';
$r['code'] = $this->mockFiles[$this->mockIndex];
$this->mockIndex++;
if ($r['code'] == 200){
$r['answer'] = 'OK';
$r['ok'] = 1;
} else if ($r['code'] == 404){
$r['answer'] = 'Not Found';
$r['error'] = 'Not Found';
$r['ok'] = 0;
} else if ($r['code'] == 503){
$r['answer'] = 'Service Unavailable';
$r['error'] = 'Service Unavailable';
$r['ok'] = 0;
} else if ($r['code'] == 400){
$r['answer'] = 'Bad Request';
$r['error'] = 'Bad Request';
$r['ok'] = 0;
}
if ($r['code'] != 200){
$r['body'] = '<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<Error>
<Type>Sender</Type>
<Code>'.$r['error'].'</Code>
<Message>'.$r['answer'].'</Message>
</Error>
<RequestID>123</RequestID>
</ErrorResponse>';
}
$r['headarray'] = array();
$this->log("Returning Mock Response: ".$r['code']);
return $r;
} | php | protected function fetchMockResponse(){
if(!is_array($this->mockFiles) || !array_key_exists(0, $this->mockFiles)){
$this->log("Attempted to retrieve mock responses, but no mock responses present",'Warning');
return false;
}
if(!array_key_exists($this->mockIndex, $this->mockFiles)){
$this->log("End of Mock List, resetting to 0");
$this->resetMock();
}
if (!is_numeric($this->mockFiles[$this->mockIndex])){
$this->log("fetchMockResponse only works with response code numbers",'Warning');
return false;
}
$r = array();
$r['head'] = 'HTTP/1.1 200 OK';
$r['body'] = '<?xml version="1.0"?><root></root>';
$r['code'] = $this->mockFiles[$this->mockIndex];
$this->mockIndex++;
if ($r['code'] == 200){
$r['answer'] = 'OK';
$r['ok'] = 1;
} else if ($r['code'] == 404){
$r['answer'] = 'Not Found';
$r['error'] = 'Not Found';
$r['ok'] = 0;
} else if ($r['code'] == 503){
$r['answer'] = 'Service Unavailable';
$r['error'] = 'Service Unavailable';
$r['ok'] = 0;
} else if ($r['code'] == 400){
$r['answer'] = 'Bad Request';
$r['error'] = 'Bad Request';
$r['ok'] = 0;
}
if ($r['code'] != 200){
$r['body'] = '<?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonaws.com/doc/2009-01-01/">
<Error>
<Type>Sender</Type>
<Code>'.$r['error'].'</Code>
<Message>'.$r['answer'].'</Message>
</Error>
<RequestID>123</RequestID>
</ErrorResponse>';
}
$r['headarray'] = array();
$this->log("Returning Mock Response: ".$r['code']);
return $r;
} | [
"protected",
"function",
"fetchMockResponse",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"mockFiles",
")",
"||",
"!",
"array_key_exists",
"(",
"0",
",",
"$",
"this",
"->",
"mockFiles",
")",
")",
"{",
"$",
"this",
"->",
"log",
... | Generates a fake HTTP response using the mock file list.
This method uses the response codes in the mock file list to generate an
HTTP response. The success or failure of this operation will be recorded
in the log, including the response code returned. This is only used by
a few operations. The response array will contain the following fields:
<ul>
<li><b>head</b> - ignored, but set for the sake of completion</li>
<li><b>body</b> - empty XML, also ignored</li>
<li><b>code</b> - the response code fetched from the list</li>
<li><b>answer</b> - answer message</li>
<li><b>error</b> - error message, same value as answer, not set if status is 200</li>
<li><b>ok</b> - 1 or 0, depending on if the status is 200</li>
</ul>
@return boolean|array An array containing the HTTP response, or simply
the value <b>FALSE</b> if the response could not be found or does not
match the list of valid responses. | [
"Generates",
"a",
"fake",
"HTTP",
"response",
"using",
"the",
"mock",
"file",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L274-L326 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.checkResponse | protected function checkResponse($r){
if (!is_array($r) || !array_key_exists('code', $r)){
$this->log("No Response found",'Warning');
return false;
}
if ($r['code'] == 200){
return true;
} else {
$xml = simplexml_load_string($r['body'])->Error;
$this->log("Bad Response! ".$r['code']." ".$r['error'].": ".$xml->Code." - ".$xml->Message,'Urgent');
return false;
}
} | php | protected function checkResponse($r){
if (!is_array($r) || !array_key_exists('code', $r)){
$this->log("No Response found",'Warning');
return false;
}
if ($r['code'] == 200){
return true;
} else {
$xml = simplexml_load_string($r['body'])->Error;
$this->log("Bad Response! ".$r['code']." ".$r['error'].": ".$xml->Code." - ".$xml->Message,'Urgent');
return false;
}
} | [
"protected",
"function",
"checkResponse",
"(",
"$",
"r",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"r",
")",
"||",
"!",
"array_key_exists",
"(",
"'code'",
",",
"$",
"r",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"No Response found\"",
","... | Checks whether or not the response is OK.
Verifies whether or not the HTTP response has the 200 OK code. If the code
is not 200, the incident and error message returned are logged.
@param array $r <p>The HTTP response array. Expects the array to have
the fields <i>code</i>, <i>body</i>, and <i>error</i>.</p>
@return boolean <b>TRUE</b> if the status is 200 OK, <b>FALSE</b> otherwise. | [
"Checks",
"whether",
"or",
"not",
"the",
"response",
"is",
"OK",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L337-L349 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.setConfig | public function setConfig($path){
if (file_exists($path) && is_readable($path)){
include($path);
$this->config = $path;
$this->setLogPath($logpath);
if (isset($AMAZON_SERVICE_URL)) {
$this->urlbase = rtrim($AMAZON_SERVICE_URL, '/') . '/';
}
} else {
throw new Exception("Config file does not exist or cannot be read! ($path)");
}
} | php | public function setConfig($path){
if (file_exists($path) && is_readable($path)){
include($path);
$this->config = $path;
$this->setLogPath($logpath);
if (isset($AMAZON_SERVICE_URL)) {
$this->urlbase = rtrim($AMAZON_SERVICE_URL, '/') . '/';
}
} else {
throw new Exception("Config file does not exist or cannot be read! ($path)");
}
} | [
"public",
"function",
"setConfig",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"is_readable",
"(",
"$",
"path",
")",
")",
"{",
"include",
"(",
"$",
"path",
")",
";",
"$",
"this",
"->",
"config",
"=",
"$",
"p... | Set the config file.
This method can be used to change the config file after the object has
been initiated. The file will not be set if it cannot be found or read.
This is useful for testing, in cases where you want to use a different file.
@param string $path <p>The path to the config file.</p>
@throws Exception If the file cannot be found or read. | [
"Set",
"the",
"config",
"file",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L360-L371 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.setLogPath | public function setLogPath($path){
if (!file_exists($path)){
touch($path);
}
if (file_exists($path) && is_readable($path)){
$this->logpath = $path;
} else {
throw new Exception("Log file does not exist or cannot be read! ($path)");
}
} | php | public function setLogPath($path){
if (!file_exists($path)){
touch($path);
}
if (file_exists($path) && is_readable($path)){
$this->logpath = $path;
} else {
throw new Exception("Log file does not exist or cannot be read! ($path)");
}
} | [
"public",
"function",
"setLogPath",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"touch",
"(",
"$",
"path",
")",
";",
"}",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"is_readable",
"(",
"... | Set the log file path.
Use this method to change the log file used. This method is called
each time the config file is changed.
@param string $path <p>The path to the log file.</p>
@throws Exception If the file cannot be found or read. | [
"Set",
"the",
"log",
"file",
"path",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L381-L392 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.setStore | public function setStore($s=null){
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (empty($store) || !is_array($store)) {
throw new Exception("No stores defined!");
}
if (!isset($s) && count($store)===1) {
$s=key($store);
}
if(array_key_exists($s, $store)){
$this->storeName = $s;
if(array_key_exists('merchantId', $store[$s])){
$this->options['SellerId'] = $store[$s]['merchantId'];
} else {
$this->log("Merchant ID is missing!",'Warning');
}
if(array_key_exists('keyId', $store[$s])){
$this->options['AWSAccessKeyId'] = $store[$s]['keyId'];
} else {
$this->log("Access Key ID is missing!",'Warning');
}
if(!array_key_exists('secretKey', $store[$s])){
$this->log("Secret Key is missing!",'Warning');
}
if (!empty($store[$s]['serviceUrl'])) {
$this->urlbase = $store[$s]['serviceUrl'];
}
if (!empty($store[$s]['MWSAuthToken'])) {
$this->options['MWSAuthToken'] = $store[$s]['MWSAuthToken'];
}
} else {
$this->log("Store $s does not exist!",'Warning');
}
} | php | public function setStore($s=null){
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (empty($store) || !is_array($store)) {
throw new Exception("No stores defined!");
}
if (!isset($s) && count($store)===1) {
$s=key($store);
}
if(array_key_exists($s, $store)){
$this->storeName = $s;
if(array_key_exists('merchantId', $store[$s])){
$this->options['SellerId'] = $store[$s]['merchantId'];
} else {
$this->log("Merchant ID is missing!",'Warning');
}
if(array_key_exists('keyId', $store[$s])){
$this->options['AWSAccessKeyId'] = $store[$s]['keyId'];
} else {
$this->log("Access Key ID is missing!",'Warning');
}
if(!array_key_exists('secretKey', $store[$s])){
$this->log("Secret Key is missing!",'Warning');
}
if (!empty($store[$s]['serviceUrl'])) {
$this->urlbase = $store[$s]['serviceUrl'];
}
if (!empty($store[$s]['MWSAuthToken'])) {
$this->options['MWSAuthToken'] = $store[$s]['MWSAuthToken'];
}
} else {
$this->log("Store $s does not exist!",'Warning');
}
} | [
"public",
"function",
"setStore",
"(",
"$",
"s",
"=",
"null",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"config",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",... | Sets the store values.
This method sets a number of key values from the config file. These values
include your Merchant ID, Access Key ID, and Secret Key, and are critical
for making requests with Amazon. If the store cannot be found in the
config file, or if any of the key values are missing,
the incident will be logged.
@param string $s [optional] <p>The store name to look for.
This parameter is not required if there is only one store defined in the config file.</p>
@throws Exception If the file can't be found. | [
"Sets",
"the",
"store",
"values",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L406-L446 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.log | protected function log($msg, $level = 'Info'){
if ($msg != false) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (isset($logfunction) && $logfunction != '' && function_exists($logfunction)){
switch ($level){
case('Info'): $loglevel = LOG_INFO; break;
case('Throttle'): $loglevel = LOG_INFO; break;
case('Warning'): $loglevel = LOG_NOTICE; break;
case('Urgent'): $loglevel = LOG_ERR; break;
default: $loglevel = LOG_INFO;
}
call_user_func($logfunction,$msg,$loglevel);
}
if (isset($muteLog) && $muteLog == true){
return;
}
if(isset($userName) && $userName != ''){
$name = $userName;
}else{
$name = 'guest';
}
if(isset($backtrace) && isset($backtrace[1]) && isset($backtrace[1]['file']) && isset($backtrace[1]['line']) && isset($backtrace[1]['function'])){
$fileName = basename($backtrace[1]['file']);
$file = $backtrace[1]['file'];
$line = $backtrace[1]['line'];
$function = $backtrace[1]['function'];
}else{
$fileName = basename($backtrace[0]['file']);
$file = $backtrace[0]['file'];
$line = $backtrace[0]['line'];
$function = $backtrace[0]['function'];
}
if(isset($_SERVER['REMOTE_ADDR'])){
$ip = $_SERVER['REMOTE_ADDR'];
if($ip == '127.0.0.1')$ip = 'local';//save some char
}else{
$ip = 'cli';
}
if (!file_exists($this->logpath)) {
//attempt to create the file if it does not exist
file_put_contents($this->logpath, "This is the Amazon log, for Amazon classes to use.\n");
}
if (file_exists($this->logpath) && is_writable($this->logpath)){
$str = "[$level][" . date("Y/m/d H:i:s") . " $name@$ip $fileName:$line $function] " . $msg;
$fd = fopen($this->logpath, "a+");
fwrite($fd,$str . "\r\n");
fclose($fd);
} else {
throw new Exception('Error! Cannot write to log! ('.$this->logpath.')');
}
} else {
return false;
}
} | php | protected function log($msg, $level = 'Info'){
if ($msg != false) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (isset($logfunction) && $logfunction != '' && function_exists($logfunction)){
switch ($level){
case('Info'): $loglevel = LOG_INFO; break;
case('Throttle'): $loglevel = LOG_INFO; break;
case('Warning'): $loglevel = LOG_NOTICE; break;
case('Urgent'): $loglevel = LOG_ERR; break;
default: $loglevel = LOG_INFO;
}
call_user_func($logfunction,$msg,$loglevel);
}
if (isset($muteLog) && $muteLog == true){
return;
}
if(isset($userName) && $userName != ''){
$name = $userName;
}else{
$name = 'guest';
}
if(isset($backtrace) && isset($backtrace[1]) && isset($backtrace[1]['file']) && isset($backtrace[1]['line']) && isset($backtrace[1]['function'])){
$fileName = basename($backtrace[1]['file']);
$file = $backtrace[1]['file'];
$line = $backtrace[1]['line'];
$function = $backtrace[1]['function'];
}else{
$fileName = basename($backtrace[0]['file']);
$file = $backtrace[0]['file'];
$line = $backtrace[0]['line'];
$function = $backtrace[0]['function'];
}
if(isset($_SERVER['REMOTE_ADDR'])){
$ip = $_SERVER['REMOTE_ADDR'];
if($ip == '127.0.0.1')$ip = 'local';//save some char
}else{
$ip = 'cli';
}
if (!file_exists($this->logpath)) {
//attempt to create the file if it does not exist
file_put_contents($this->logpath, "This is the Amazon log, for Amazon classes to use.\n");
}
if (file_exists($this->logpath) && is_writable($this->logpath)){
$str = "[$level][" . date("Y/m/d H:i:s") . " $name@$ip $fileName:$line $function] " . $msg;
$fd = fopen($this->logpath, "a+");
fwrite($fd,$str . "\r\n");
fclose($fd);
} else {
throw new Exception('Error! Cannot write to log! ('.$this->logpath.')');
}
} else {
return false;
}
} | [
"protected",
"function",
"log",
"(",
"$",
"msg",
",",
"$",
"level",
"=",
"'Info'",
")",
"{",
"if",
"(",
"$",
"msg",
"!=",
"false",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
"DEBUG_BACKTRACE_IGNORE_ARGS",
")",
";",
"if",
"(",
"file_exists",... | Writes a message to the log.
This method adds a message line to the log file defined by the config.
This includes the priority level, user IP, and a backtrace of the call.
@param string $msg <p>The message to write to the log.</p>
@param string $level [optional] <p>The priority level of the message.
This is merely for the benefit of the user and does not affect how
the code runs. The values used in this library are "Info", "Warning",
"Urgent", and "Throttle".</p>
@return boolean <b>FALSE</b> if the message is empty, NULL if logging is muted
@throws Exception If the file can't be written to. | [
"Writes",
"a",
"message",
"to",
"the",
"log",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L472-L534 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.genTime | protected function genTime($time=false){
if (!$time){
$time = time();
} else if (is_numeric($time)) {
$time = (int)$time;
} else if (is_string($time)) {
$time = strtotime($time);
} else {
throw new InvalidArgumentException('Invalid time input given');
}
return date('c', $time-120);
} | php | protected function genTime($time=false){
if (!$time){
$time = time();
} else if (is_numeric($time)) {
$time = (int)$time;
} else if (is_string($time)) {
$time = strtotime($time);
} else {
throw new InvalidArgumentException('Invalid time input given');
}
return date('c', $time-120);
} | [
"protected",
"function",
"genTime",
"(",
"$",
"time",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"time",
")",
"{",
"$",
"time",
"=",
"time",
"(",
")",
";",
"}",
"else",
"if",
"(",
"is_numeric",
"(",
"$",
"time",
")",
")",
"{",
"$",
"time",
... | Generates timestamp in ISO8601 format.
This method creates a timestamp from the provided string in ISO8601 format.
The string given is passed through <i>strtotime</i> before being used. The
value returned is actually two minutes early, to prevent it from tripping up
Amazon. If no time is given, the current time is used.
@param string|int $time [optional] <p>The time to use. Since any string values are
passed through <i>strtotime</i> first, values such as "-1 hour" are fine.
Unix timestamps are also allowed. Purely numeric values are treated as unix timestamps.
Defaults to the current time.</p>
@return string Unix timestamp of the time, minus 2 minutes.
@throws InvalidArgumentException | [
"Generates",
"timestamp",
"in",
"ISO8601",
"format",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L561-L573 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.genQuery | protected function genQuery(){
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (array_key_exists($this->storeName, $store) && array_key_exists('secretKey', $store[$this->storeName])){
$secretKey = $store[$this->storeName]['secretKey'];
} else {
throw new Exception("Secret Key is missing!");
}
unset($this->options['Signature']);
$this->options['Timestamp'] = $this->genTime();
$this->options['Signature'] = $this->_signParameters($this->options, $secretKey);
return $this->_getParametersAsString($this->options);
} | php | protected function genQuery(){
if (file_exists($this->config)){
include($this->config);
} else {
throw new Exception("Config file does not exist!");
}
if (array_key_exists($this->storeName, $store) && array_key_exists('secretKey', $store[$this->storeName])){
$secretKey = $store[$this->storeName]['secretKey'];
} else {
throw new Exception("Secret Key is missing!");
}
unset($this->options['Signature']);
$this->options['Timestamp'] = $this->genTime();
$this->options['Signature'] = $this->_signParameters($this->options, $secretKey);
return $this->_getParametersAsString($this->options);
} | [
"protected",
"function",
"genQuery",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"config",
")",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"config",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"Exception",
"(",
"\"Config file doe... | Handles generation of the signed query string.
This method uses the secret key from the config file to generate the
signed query string.
It also handles the creation of the timestamp option prior.
@return string query string to send to cURL
@throws Exception if config file or secret key is missing | [
"Handles",
"generation",
"of",
"the",
"signed",
"query",
"string",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L584-L601 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.sendRequest | protected function sendRequest($url,$param){
$this->log("Making request to Amazon: ".$this->options['Action']);
$response = $this->fetchURL($url,$param);
while (isset($response['code']) && $response['code'] == '503' && $this->throttleStop==false){
$this->sleep();
$response = $this->fetchURL($url,$param);
}
$this->rawResponses[]=$response;
return $response;
} | php | protected function sendRequest($url,$param){
$this->log("Making request to Amazon: ".$this->options['Action']);
$response = $this->fetchURL($url,$param);
while (isset($response['code']) && $response['code'] == '503' && $this->throttleStop==false){
$this->sleep();
$response = $this->fetchURL($url,$param);
}
$this->rawResponses[]=$response;
return $response;
} | [
"protected",
"function",
"sendRequest",
"(",
"$",
"url",
",",
"$",
"param",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Making request to Amazon: \"",
".",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
")",
";",
"$",
"response",
"=",
"$",
"this",
... | Sends a request to Amazon via cURL
This method will keep trying if the request was throttled.
@param string $url <p>URL to feed to cURL</p>
@param array $param <p>parameter array to feed to cURL</p>
@return array cURL response array | [
"Sends",
"a",
"request",
"to",
"Amazon",
"via",
"cURL"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L611-L622 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.getLastResponse | public function getLastResponse($i=NULL) {
if (!isset($i)) {
$i=count($this->rawResponses)-1;
}
if ($i >= 0 && isset($this->rawResponses[$i])) {
return $this->rawResponses[$i];
} else {
return false;
}
} | php | public function getLastResponse($i=NULL) {
if (!isset($i)) {
$i=count($this->rawResponses)-1;
}
if ($i >= 0 && isset($this->rawResponses[$i])) {
return $this->rawResponses[$i];
} else {
return false;
}
} | [
"public",
"function",
"getLastResponse",
"(",
"$",
"i",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"i",
")",
")",
"{",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"rawResponses",
")",
"-",
"1",
";",
"}",
"if",
"(",
"$",
"i"... | Gives the latest response data received from Amazon.
Response arrays contain the following keys:
<ul>
<li><b>head</b> - The raw HTTP head, including the response code and content length</li>
<li><b>body</b> - The raw HTTP body, which will almost always be in XML format</li>
<li><b>code</b> - The HTTP response code extracted from the head for convenience</li>
<li><b>answer</b> - The HTTP response message extracted from the head for convenience</li>
<li><b>ok</b> - Contains a <b>1</b> if the response was normal, or <b>0</b> if there was a problem</li>
<li><b>headarray</b> - An associative array of the head data, for convenience</li>
</ul>
@param int $i [optional] <p>If set, retrieves the specific response instead of the last one.
If the index for the response is not used, <b>FALSE</b> will be returned.</p>
@return array associative array of HTTP response or <b>FALSE</b> if not set yet | [
"Gives",
"the",
"latest",
"response",
"data",
"received",
"from",
"Amazon",
".",
"Response",
"arrays",
"contain",
"the",
"following",
"keys",
":",
"<ul",
">",
"<li",
">",
"<b",
">",
"head<",
"/",
"b",
">",
"-",
"The",
"raw",
"HTTP",
"head",
"including",
... | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L639-L648 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.getLastErrorResponse | public function getLastErrorResponse() {
if (!empty($this->rawResponses)) {
foreach (array_reverse($this->rawResponses) as $x) {
if (isset($x['error'])) {
return $x;
}
}
}
} | php | public function getLastErrorResponse() {
if (!empty($this->rawResponses)) {
foreach (array_reverse($this->rawResponses) as $x) {
if (isset($x['error'])) {
return $x;
}
}
}
} | [
"public",
"function",
"getLastErrorResponse",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"rawResponses",
")",
")",
"{",
"foreach",
"(",
"array_reverse",
"(",
"$",
"this",
"->",
"rawResponses",
")",
"as",
"$",
"x",
")",
"{",
"if",
... | Gives the last response with an error code.
This may or may not be the same as the last response if multiple requests were made.
@return array associative array of HTTP response or <b>NULL</b> if no error response yet
@see getLastResponse | [
"Gives",
"the",
"last",
"response",
"with",
"an",
"error",
"code",
".",
"This",
"may",
"or",
"may",
"not",
"be",
"the",
"same",
"as",
"the",
"last",
"response",
"if",
"multiple",
"requests",
"were",
"made",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L682-L690 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.getLastErrorCode | public function getLastErrorCode() {
$last = $this->getLastErrorResponse();
if (!empty($last['body'])) {
$xml = simplexml_load_string($last['body']);
if (isset($xml->Error->Code)) {
return $xml->Error->Code;
}
}
} | php | public function getLastErrorCode() {
$last = $this->getLastErrorResponse();
if (!empty($last['body'])) {
$xml = simplexml_load_string($last['body']);
if (isset($xml->Error->Code)) {
return $xml->Error->Code;
}
}
} | [
"public",
"function",
"getLastErrorCode",
"(",
")",
"{",
"$",
"last",
"=",
"$",
"this",
"->",
"getLastErrorResponse",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"last",
"[",
"'body'",
"]",
")",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",... | Gives the Amazon error code from the last error response.
The error code uses words rather than numbers. (Ex: "InvalidParameterValue")
This data can also be found in the XML body given by getLastErrorResponse.
@return string Amazon error code or <b>NULL</b> if not set yet or no error response yet
@see getLastErrorResponse | [
"Gives",
"the",
"Amazon",
"error",
"code",
"from",
"the",
"last",
"error",
"response",
".",
"The",
"error",
"code",
"uses",
"words",
"rather",
"than",
"numbers",
".",
"(",
"Ex",
":",
"InvalidParameterValue",
")",
"This",
"data",
"can",
"also",
"be",
"found... | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L699-L707 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.getLastErrorMessage | public function getLastErrorMessage() {
$last = $this->getLastErrorResponse();
if (!empty($last['body'])) {
$xml = simplexml_load_string($last['body']);
if (isset($xml->Error->Message)) {
return $xml->Error->Message;
}
}
} | php | public function getLastErrorMessage() {
$last = $this->getLastErrorResponse();
if (!empty($last['body'])) {
$xml = simplexml_load_string($last['body']);
if (isset($xml->Error->Message)) {
return $xml->Error->Message;
}
}
} | [
"public",
"function",
"getLastErrorMessage",
"(",
")",
"{",
"$",
"last",
"=",
"$",
"this",
"->",
"getLastErrorResponse",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"last",
"[",
"'body'",
"]",
")",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_strin... | Gives the error message from the last error response.
Not all error responses will have error messages.
This data can also be found in the XML body given by getLastErrorResponse.
@return string Amazon error code or <b>NULL</b> if not set yet or no error response yet
@see getLastErrorResponse | [
"Gives",
"the",
"error",
"message",
"from",
"the",
"last",
"error",
"response",
".",
"Not",
"all",
"error",
"responses",
"will",
"have",
"error",
"messages",
".",
"This",
"data",
"can",
"also",
"be",
"found",
"in",
"the",
"XML",
"body",
"given",
"by",
"g... | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L716-L724 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.sleep | protected function sleep(){
flush();
$s = ($this->throttleTime == 1) ? '' : 's';
$this->log("Request was throttled, Sleeping for ".$this->throttleTime." second$s",'Throttle');
sleep($this->throttleTime);
} | php | protected function sleep(){
flush();
$s = ($this->throttleTime == 1) ? '' : 's';
$this->log("Request was throttled, Sleeping for ".$this->throttleTime." second$s",'Throttle');
sleep($this->throttleTime);
} | [
"protected",
"function",
"sleep",
"(",
")",
"{",
"flush",
"(",
")",
";",
"$",
"s",
"=",
"(",
"$",
"this",
"->",
"throttleTime",
"==",
"1",
")",
"?",
"''",
":",
"'s'",
";",
"$",
"this",
"->",
"log",
"(",
"\"Request was throttled, Sleeping for \"",
".",
... | Sleeps for the throttle time and records to the log. | [
"Sleeps",
"for",
"the",
"throttle",
"time",
"and",
"records",
"to",
"the",
"log",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L729-L734 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.checkToken | protected function checkToken($xml){
if ($xml && $xml->NextToken && (string)$xml->HasNext != 'false' && (string)$xml->MoreResultsAvailable != 'false'){
$this->tokenFlag = true;
$this->options['NextToken'] = (string)$xml->NextToken;
} else {
unset($this->options['NextToken']);
$this->tokenFlag = false;
}
} | php | protected function checkToken($xml){
if ($xml && $xml->NextToken && (string)$xml->HasNext != 'false' && (string)$xml->MoreResultsAvailable != 'false'){
$this->tokenFlag = true;
$this->options['NextToken'] = (string)$xml->NextToken;
} else {
unset($this->options['NextToken']);
$this->tokenFlag = false;
}
} | [
"protected",
"function",
"checkToken",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"$",
"xml",
"&&",
"$",
"xml",
"->",
"NextToken",
"&&",
"(",
"string",
")",
"$",
"xml",
"->",
"HasNext",
"!=",
"'false'",
"&&",
"(",
"string",
")",
"$",
"xml",
"->",
"MoreR... | Checks for a token and changes the proper options
@param SimpleXMLElement $xml <p>response data</p>
@return boolean <b>FALSE</b> if no XML data | [
"Checks",
"for",
"a",
"token",
"and",
"changes",
"the",
"proper",
"options"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L741-L749 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore.fetchURL | function fetchURL ($url, $param) {
$return = array();
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_TIMEOUT, 0);
curl_setopt($ch,CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch,CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch,CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_URL,$url);
if ($this->disableSslVerify) {
$this->log('Caution: Request being sent without SSL verification.', 'Warning');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (!empty($param)){
if (!empty($param['Header'])){
curl_setopt($ch,CURLOPT_HTTPHEADER, $param['Header']);
}
if (!empty($param['Post'])){
curl_setopt($ch,CURLOPT_POSTFIELDS, $param['Post']);
}
}
$data = curl_exec($ch);
if ( curl_errno($ch) ) {
$return['ok'] = -1;
$return['error'] = curl_error($ch);
return $return;
}
if (is_numeric(strpos($data, 'HTTP/1.1 100 Continue'))) {
$data=str_replace('HTTP/1.1 100 Continue', '', $data);
}
$data = preg_split("/\r\n\r\n/",$data, 2, PREG_SPLIT_NO_EMPTY);
if (!empty($data)) {
$return['head'] = ( isset($data[0]) ? $data[0] : null );
$return['body'] = ( isset($data[1]) ? $data[1] : null );
} else {
$return['head'] = null;
$return['body'] = null;
}
$matches = array();
$data = preg_match("/HTTP\/[0-9.]+ ([0-9]+) (.+)\r\n/",$return['head'], $matches);
if (!empty($matches)) {
$return['code'] = $matches[1];
$return['answer'] = $matches[2];
}
$data = preg_match("/meta http-equiv=.refresh. +content=.[0-9]*;url=([^'\"]*)/i",$return['body'], $matches);
if (!empty($matches)) {
$return['location'] = $matches[1];
$return['code'] = '301';
}
if ( $return['code'] == '200' || $return['code'] == '302' ) {
$return['ok'] = 1;
} else {
$return['error'] = (($return['answer'] and $return['answer'] != 'OK') ? $return['answer'] : 'Something wrong!');
$return['ok'] = 0;
}
foreach (preg_split('/\n/', $return['head'], -1, PREG_SPLIT_NO_EMPTY) as $value) {
$data = preg_split('/:/', $value, 2, PREG_SPLIT_NO_EMPTY);
if (is_array($data) and isset($data['1'])) {
$return['headarray'][$data['0']] = trim($data['1']);
}
}
curl_close($ch);
return $return;
} | php | function fetchURL ($url, $param) {
$return = array();
$ch = curl_init();
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_TIMEOUT, 0);
curl_setopt($ch,CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch,CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch,CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_URL,$url);
if ($this->disableSslVerify) {
$this->log('Caution: Request being sent without SSL verification.', 'Warning');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (!empty($param)){
if (!empty($param['Header'])){
curl_setopt($ch,CURLOPT_HTTPHEADER, $param['Header']);
}
if (!empty($param['Post'])){
curl_setopt($ch,CURLOPT_POSTFIELDS, $param['Post']);
}
}
$data = curl_exec($ch);
if ( curl_errno($ch) ) {
$return['ok'] = -1;
$return['error'] = curl_error($ch);
return $return;
}
if (is_numeric(strpos($data, 'HTTP/1.1 100 Continue'))) {
$data=str_replace('HTTP/1.1 100 Continue', '', $data);
}
$data = preg_split("/\r\n\r\n/",$data, 2, PREG_SPLIT_NO_EMPTY);
if (!empty($data)) {
$return['head'] = ( isset($data[0]) ? $data[0] : null );
$return['body'] = ( isset($data[1]) ? $data[1] : null );
} else {
$return['head'] = null;
$return['body'] = null;
}
$matches = array();
$data = preg_match("/HTTP\/[0-9.]+ ([0-9]+) (.+)\r\n/",$return['head'], $matches);
if (!empty($matches)) {
$return['code'] = $matches[1];
$return['answer'] = $matches[2];
}
$data = preg_match("/meta http-equiv=.refresh. +content=.[0-9]*;url=([^'\"]*)/i",$return['body'], $matches);
if (!empty($matches)) {
$return['location'] = $matches[1];
$return['code'] = '301';
}
if ( $return['code'] == '200' || $return['code'] == '302' ) {
$return['ok'] = 1;
} else {
$return['error'] = (($return['answer'] and $return['answer'] != 'OK') ? $return['answer'] : 'Something wrong!');
$return['ok'] = 0;
}
foreach (preg_split('/\n/', $return['head'], -1, PREG_SPLIT_NO_EMPTY) as $value) {
$data = preg_split('/:/', $value, 2, PREG_SPLIT_NO_EMPTY);
if (is_array($data) and isset($data['1'])) {
$return['headarray'][$data['0']] = trim($data['1']);
}
}
curl_close($ch);
return $return;
} | [
"function",
"fetchURL",
"(",
"$",
"url",
",",
"$",
"param",
")",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_RETURNTRANSFER",
",",
"true",
")",
";",
"curl... | Get url or send POST data
@param string $url
@param array $param['Header']
$param['Post']
@return array $return['ok'] 1 - success, (0,-1) - fail
$return['body'] - response
$return['error'] - error, if "ok" is not 1
$return['head'] - http header | [
"Get",
"url",
"or",
"send",
"POST",
"data"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L779-L853 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonCore.php | AmazonCore._signParameters | protected function _signParameters(array $parameters, $key) {
$algorithm = $this->options['SignatureMethod'];
$stringToSign = null;
if (2 === $this->options['SignatureVersion']) {
$stringToSign = $this->_calculateStringToSignV2($parameters);
// var_dump($stringToSign);
} else {
throw new Exception("Invalid Signature Version specified");
}
return $this->_sign($stringToSign, $key, $algorithm);
} | php | protected function _signParameters(array $parameters, $key) {
$algorithm = $this->options['SignatureMethod'];
$stringToSign = null;
if (2 === $this->options['SignatureVersion']) {
$stringToSign = $this->_calculateStringToSignV2($parameters);
// var_dump($stringToSign);
} else {
throw new Exception("Invalid Signature Version specified");
}
return $this->_sign($stringToSign, $key, $algorithm);
} | [
"protected",
"function",
"_signParameters",
"(",
"array",
"$",
"parameters",
",",
"$",
"key",
")",
"{",
"$",
"algorithm",
"=",
"$",
"this",
"->",
"options",
"[",
"'SignatureMethod'",
"]",
";",
"$",
"stringToSign",
"=",
"null",
";",
"if",
"(",
"2",
"===",... | validates signature and sets up signing of them, copied from Amazon
@param array $parameters
@param string $key
@return string signed string
@throws Exception | [
"validates",
"signature",
"and",
"sets",
"up",
"signing",
"of",
"them",
"copied",
"from",
"Amazon"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonCore.php#L890-L900 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.setLabelPreference | public function setLabelPreference($s){
if (is_string($s) && $s){
if ($s == 'SELLER_LABEL' || $s == 'AMAZON_LABEL_ONLY' || $s == 'AMAZON_LABEL_PREFERRED'){
$this->options['LabelPrepPreference'] = $s;
} else {
return false;
}
} else {
return false;
}
} | php | public function setLabelPreference($s){
if (is_string($s) && $s){
if ($s == 'SELLER_LABEL' || $s == 'AMAZON_LABEL_ONLY' || $s == 'AMAZON_LABEL_PREFERRED'){
$this->options['LabelPrepPreference'] = $s;
} else {
return false;
}
} else {
return false;
}
} | [
"public",
"function",
"setLabelPreference",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
"&&",
"$",
"s",
")",
"{",
"if",
"(",
"$",
"s",
"==",
"'SELLER_LABEL'",
"||",
"$",
"s",
"==",
"'AMAZON_LABEL_ONLY'",
"||",
"$",
"s",
"==... | Sets the labeling preference. (Optional)
If this parameter is not set, Amazon will assume SELLER_LABEL.
@param string $s <p>"SELLER_LABEL", "AMAZON_LABEL_ONLY", "AMAZON_LABEL_PREFERRED"</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"labeling",
"preference",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L144-L154 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.setItems | public function setItems($a){
if (!$a || is_null($a) || is_string($a)){
$this->log("Tried to set Items to invalid values",'Warning');
return false;
}
$this->resetItems();
$i = 1;
foreach ($a as $x){
if (array_key_exists('SellerSKU', $x) && array_key_exists('Quantity', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.SellerSKU'] = $x['SellerSKU'];
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.Quantity'] = $x['Quantity'];
if (array_key_exists('ASIN', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.ASIN'] = $x['ASIN'];
}
if (array_key_exists('QuantityInCase', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.QuantityInCase'] = $x['QuantityInCase'];
}
if (array_key_exists('Condition', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.Condition'] = $x['Condition'];
}
if (array_key_exists('PrepDetailsList', $x) && is_array($x['PrepDetailsList'])){
$j = 1;
foreach ($x['PrepDetailsList'] as $z) {
if (!isset($z['PrepInstruction']) || !isset($z['PrepOwner'])) {
$this->log("Tried to set invalid prep details for item",'Warning');
continue;
}
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.PrepDetailsList.PrepDetails.'.$j.'.PrepInstruction'] = $z['PrepInstruction'];
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.PrepDetailsList.PrepDetails.'.$j.'.PrepOwner'] = $z['PrepOwner'];
$j++;
}
}
$i++;
} else {
$this->resetItems();
$this->log("Tried to set Items with invalid array",'Warning');
return false;
}
}
} | php | public function setItems($a){
if (!$a || is_null($a) || is_string($a)){
$this->log("Tried to set Items to invalid values",'Warning');
return false;
}
$this->resetItems();
$i = 1;
foreach ($a as $x){
if (array_key_exists('SellerSKU', $x) && array_key_exists('Quantity', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.SellerSKU'] = $x['SellerSKU'];
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.Quantity'] = $x['Quantity'];
if (array_key_exists('ASIN', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.ASIN'] = $x['ASIN'];
}
if (array_key_exists('QuantityInCase', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.QuantityInCase'] = $x['QuantityInCase'];
}
if (array_key_exists('Condition', $x)){
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.Condition'] = $x['Condition'];
}
if (array_key_exists('PrepDetailsList', $x) && is_array($x['PrepDetailsList'])){
$j = 1;
foreach ($x['PrepDetailsList'] as $z) {
if (!isset($z['PrepInstruction']) || !isset($z['PrepOwner'])) {
$this->log("Tried to set invalid prep details for item",'Warning');
continue;
}
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.PrepDetailsList.PrepDetails.'.$j.'.PrepInstruction'] = $z['PrepInstruction'];
$this->options['InboundShipmentPlanRequestItems.member.'.$i.'.PrepDetailsList.PrepDetails.'.$j.'.PrepOwner'] = $z['PrepOwner'];
$j++;
}
}
$i++;
} else {
$this->resetItems();
$this->log("Tried to set Items with invalid array",'Warning');
return false;
}
}
} | [
"public",
"function",
"setItems",
"(",
"$",
"a",
")",
"{",
"if",
"(",
"!",
"$",
"a",
"||",
"is_null",
"(",
"$",
"a",
")",
"||",
"is_string",
"(",
"$",
"a",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Tried to set Items to invalid values\"",
",",... | Sets the items. (Required)
This method sets the Fulfillment Order ID to be sent in the next request.
This parameter is required for creating a fulfillment order with Amazon.
The array provided should contain a list of arrays, each with the following fields:
<ul>
<li><b>SellerSKU</b> - max: 200 char</li>
<li><b>Quantity</b> - numeric</li>
<li><b>ASIN</b> (optional) - must be valid</li>
<li><b>QuantityInCase</b> (optional) - numeric</li>
<li><b>Condition</b> (optional) - Valid Values:</li>
<ul>
<li>NewItem</li>
<li>NewWithWarranty</li>
<li>NewOEM</li>
<li>NewOpenBox</li>
<li>UsedLikeNew</li>
<li>UsedVeryGood</li>
<li>UsedGood</li>
<li>UsedAcceptable</li>
<li>UsedPoor</li>
<li>UsedRefurbished</li>
<li>CollectibleLikeNew</li>
<li>CollectibleVeryGood</li>
<li>CollectibleGood</li>
<li>CollectibleAcceptable</li>
<li>CollectiblePoor</li>
<li>RefurbishedWithWarranty</li>
<li>Refurbished</li>
<li>Club</li>
</ul>
<li><b>PrepDetailsList</b> (optional) - Array with keys "PrepInstruction" and "PrepOwner".
Valid values for "PrepInstruction":</li>
<ul>
<li>Polybagging</li>
<li>BubbleWrapping</li>
<li>Taping</li>
<li>BlackShrinkWrapping</li>
<li>Labeling</li>
<li>HangGarment</li>
</ul>
</ul>
@param array $a <p>See above.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"items",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L202-L241 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.resetItems | public function resetItems(){
foreach($this->options as $op=>$junk){
if(preg_match("#InboundShipmentPlanRequestItems#",$op)){
unset($this->options[$op]);
}
}
} | php | public function resetItems(){
foreach($this->options as $op=>$junk){
if(preg_match("#InboundShipmentPlanRequestItems#",$op)){
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetItems",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#InboundShipmentPlanRequestItems#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
... | Resets the item options.
Since the list of items is a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"item",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L249-L255 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.parseXML | protected function parseXML($xml) {
if (!$xml){
return false;
}
$i = 0;
foreach($xml->children() as $x){
foreach($x->ShipToAddress->children() as $y => $z){
$this->planList[$i]['ShipToAddress'][$y] = (string)$z;
}
$this->planList[$i]['ShipmentId'] = (string)$x->ShipmentId;
$this->planList[$i]['DestinationFulfillmentCenterId'] = (string)$x->DestinationFulfillmentCenterId;
$this->planList[$i]['LabelPrepType'] = (string)$x->LabelPrepType;
$j = 0;
foreach($x->Items->children() as $y => $z){
$this->planList[$i]['Items'][$j]['SellerSKU'] = (string)$z->SellerSKU;
$this->planList[$i]['Items'][$j]['Quantity'] = (string)$z->Quantity;
$this->planList[$i]['Items'][$j]['FulfillmentNetworkSKU'] = (string)$z->FulfillmentNetworkSKU;
if (isset($z->PrepDetailsList)) {
foreach ($z->PrepDetailsList as $zz) {
$temp = array();
$temp['PrepInstruction'] = (string)$zz->PrepInstruction;
$temp['PrepOwner'] = (string)$zz->PrepOwner;
$this->planList[$i]['Items'][$j]['PrepDetailsList'][] = $temp;
}
}
$j++;
}
$i++;
}
} | php | protected function parseXML($xml) {
if (!$xml){
return false;
}
$i = 0;
foreach($xml->children() as $x){
foreach($x->ShipToAddress->children() as $y => $z){
$this->planList[$i]['ShipToAddress'][$y] = (string)$z;
}
$this->planList[$i]['ShipmentId'] = (string)$x->ShipmentId;
$this->planList[$i]['DestinationFulfillmentCenterId'] = (string)$x->DestinationFulfillmentCenterId;
$this->planList[$i]['LabelPrepType'] = (string)$x->LabelPrepType;
$j = 0;
foreach($x->Items->children() as $y => $z){
$this->planList[$i]['Items'][$j]['SellerSKU'] = (string)$z->SellerSKU;
$this->planList[$i]['Items'][$j]['Quantity'] = (string)$z->Quantity;
$this->planList[$i]['Items'][$j]['FulfillmentNetworkSKU'] = (string)$z->FulfillmentNetworkSKU;
if (isset($z->PrepDetailsList)) {
foreach ($z->PrepDetailsList as $zz) {
$temp = array();
$temp['PrepInstruction'] = (string)$zz->PrepInstruction;
$temp['PrepOwner'] = (string)$zz->PrepOwner;
$this->planList[$i]['Items'][$j]['PrepDetailsList'][] = $temp;
}
}
$j++;
}
$i++;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"xml",
"->",
"children",
"(",
")",
"as",
"$",
"x",
")",
"{",
"for... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L303-L334 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.getPlan | public function getPlan($i = null){
if (!isset($this->planList)){
return false;
} else {
if (is_int($i)){
return $this->planList[$i];
} else {
return $this->planList;
}
}
} | php | public function getPlan($i = null){
if (!isset($this->planList)){
return false;
} else {
if (is_int($i)){
return $this->planList[$i];
} else {
return $this->planList;
}
}
} | [
"public",
"function",
"getPlan",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"planList",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"r... | Returns the supply type for the specified entry.
If <i>$i</i> is not specified, the entire list of plans will be returned.
This method will return <b>FALSE</b> if the list has not yet been filled.
The returned array of a single plan will contain the following fields:
<ul>
<li><b>ShipToAddress</b> - See <i>getAddress</i> for details.</li>
<li><b>ShipmentId</b> - Unique ID for the shipment to use.</li>
<li><b>DestinationFulfillmentCenterId</b> - ID for the Fulfillment Center the shipment would ship to.</li>
<li><b>LabelPrepType</b> - Label preparation required.</li>
<li><b>Items</b> - See <i>getItems</i> for details.</li>
</ul>
@param int $i [optional] <p>List index to retrieve the value from. Defaults to NULL.</p>
@return array|boolean plan array, multi-dimensional array, or <b>FALSE</b> if invalid index | [
"Returns",
"the",
"supply",
"type",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L352-L362 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.getShipmentIdList | public function getShipmentIdList(){
if (!isset($this->planList)){
return false;
}
$a = array();
foreach($this->planList as $x){
$a[] = $x['ShipmentId'];
}
return $a;
} | php | public function getShipmentIdList(){
if (!isset($this->planList)){
return false;
}
$a = array();
foreach($this->planList as $x){
$a[] = $x['ShipmentId'];
}
return $a;
} | [
"public",
"function",
"getShipmentIdList",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"planList",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"a",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"planList",... | Returns an array of only the shipping IDs for convenient use.
This method will return <b>FALSE</b> if the list has not yet been filled.
@return array|boolean list of shipping IDs, or <b>FALSE</b> if list not fetched yet | [
"Returns",
"an",
"array",
"of",
"only",
"the",
"shipping",
"IDs",
"for",
"convenient",
"use",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L370-L379 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentPlanner.php | AmazonShipmentPlanner.getShipmentId | public function getShipmentId($i = 0){
if (!isset($this->planList)){
return false;
}
if (is_int($i)){
return $this->planList[$i]['ShipmentId'];
} else {
return false;
}
} | php | public function getShipmentId($i = 0){
if (!isset($this->planList)){
return false;
}
if (is_int($i)){
return $this->planList[$i]['ShipmentId'];
} else {
return false;
}
} | [
"public",
"function",
"getShipmentId",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"planList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",... | Returns the shipment ID for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"shipment",
"ID",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentPlanner.php#L388-L397 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.setRequestIds | public function setRequestIds($s){
if (is_string($s)){
$this->resetRequestIds();
$this->options['ReportRequestIdList.Id.1'] = $s;
} else if (is_array($s)){
$this->resetRequestIds();
$i = 1;
foreach ($s as $x){
$this->options['ReportRequestIdList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setRequestIds($s){
if (is_string($s)){
$this->resetRequestIds();
$this->options['ReportRequestIdList.Id.1'] = $s;
} else if (is_array($s)){
$this->resetRequestIds();
$i = 1;
foreach ($s as $x){
$this->options['ReportRequestIdList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setRequestIds",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetRequestIds",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'ReportRequestIdList.Id.1'",
"]",
"=",
"$",
... | Sets the report request ID(s). (Optional)
This method sets the list of report request IDs to be sent in the next request.
@param array|string $s <p>A list of report request IDs, or a single type string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"report",
"request",
"ID",
"(",
"s",
")",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L94-L108 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.resetRequestIds | public function resetRequestIds(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportRequestIdList#",$op)){
unset($this->options[$op]);
}
}
} | php | public function resetRequestIds(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportRequestIdList#",$op)){
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetRequestIds",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ReportRequestIdList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"(",
... | Removes report request ID options.
Use this in case you change your mind and want to remove the Report Request ID
parameters you previously set. | [
"Removes",
"report",
"request",
"ID",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L116-L122 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.setReportStatuses | public function setReportStatuses($s){
if (is_string($s)){
$this->resetReportStatuses();
$this->options['ReportProcessingStatusList.Status.1'] = $s;
} else if (is_array($s)){
$this->resetReportStatuses();
$i = 1;
foreach ($s as $x){
$this->options['ReportProcessingStatusList.Status.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setReportStatuses($s){
if (is_string($s)){
$this->resetReportStatuses();
$this->options['ReportProcessingStatusList.Status.1'] = $s;
} else if (is_array($s)){
$this->resetReportStatuses();
$i = 1;
foreach ($s as $x){
$this->options['ReportProcessingStatusList.Status.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setReportStatuses",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetReportStatuses",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'ReportProcessingStatusList.Status.1'",
"... | Sets the report status(es). (Optional)
This method sets the list of report types to be sent in the next request.
@param array|string $s <p>A list of report types, or a single type string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"report",
"status",
"(",
"es",
")",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L168-L182 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.resetReportStatuses | public function resetReportStatuses(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportProcessingStatusList#",$op)){
unset($this->options[$op]);
}
}
} | php | public function resetReportStatuses(){
foreach($this->options as $op=>$junk){
if(preg_match("#ReportProcessingStatusList#",$op)){
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetReportStatuses",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ReportProcessingStatusList#\"",
",",
"$",
"op",
")",
")",
"{",
"unse... | Removes report status options.
Use this in case you change your mind and want to remove the Report Status
parameters you previously set. | [
"Removes",
"report",
"status",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L190-L196 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.setMaxCount | public function setMaxCount($s){
if (is_int($s) && $s >= 1 && $s <= 100){
$this->options['MaxCount'] = $s;
} else {
return false;
}
} | php | public function setMaxCount($s){
if (is_int($s) && $s >= 1 && $s <= 100){
$this->options['MaxCount'] = $s;
} else {
return false;
}
} | [
"public",
"function",
"setMaxCount",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_int",
"(",
"$",
"s",
")",
"&&",
"$",
"s",
">=",
"1",
"&&",
"$",
"s",
"<=",
"100",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'MaxCount'",
"]",
"=",
"$",
"s",
";",... | Sets the maximum response count. (Optional)
This method sets the maximum number of Report Requests for Amazon to return.
If this parameter is not set, Amazon will only send 10 at a time.
@param array|string $s <p>Positive integer from 1 to 100.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"maximum",
"response",
"count",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L206-L212 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.setTimeLimits | public function setTimeLimits($s = null,$e = null){
if ($s && is_string($s)){
$times = $this->genTime($s);
$this->options['RequestedFromDate'] = $times;
}
if ($e && is_string($e)){
$timee = $this->genTime($e);
$this->options['RequestedToDate'] = $timee;
}
if (isset($this->options['RequestedFromDate']) &&
isset($this->options['RequestedToDate']) &&
$this->options['RequestedFromDate'] > $this->options['RequestedToDate']){
$this->setTimeLimits($this->options['RequestedToDate'].' - 1 second');
}
} | php | public function setTimeLimits($s = null,$e = null){
if ($s && is_string($s)){
$times = $this->genTime($s);
$this->options['RequestedFromDate'] = $times;
}
if ($e && is_string($e)){
$timee = $this->genTime($e);
$this->options['RequestedToDate'] = $timee;
}
if (isset($this->options['RequestedFromDate']) &&
isset($this->options['RequestedToDate']) &&
$this->options['RequestedFromDate'] > $this->options['RequestedToDate']){
$this->setTimeLimits($this->options['RequestedToDate'].' - 1 second');
}
} | [
"public",
"function",
"setTimeLimits",
"(",
"$",
"s",
"=",
"null",
",",
"$",
"e",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"s",
"&&",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"times",
"=",
"$",
"this",
"->",
"genTime",
"(",
"$",
"s",
")"... | Sets the time frame options. (Optional)
This method sets the start and end times for the next request. If this
parameter is set, Amazon will only return Report Requests that were submitted
between the two times given. If these parameters are not set, Amazon will
only return Report Requests that were submitted within the past 90 days.
The parameters are passed through <i>strtotime</i>, so values such as "-1 hour" are fine.
@param string $s [optional] <p>A time string for the earliest time.</p>
@param string $e [optional] <p>A time string for the latest time.</p> | [
"Sets",
"the",
"time",
"frame",
"options",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L225-L239 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.prepareToken | protected function prepareToken(){
include($this->env);
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'GetReportRequestListByNextToken';
if(isset($THROTTLE_LIMIT_REPORTTOKEN)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTTOKEN;
}
if(isset($THROTTLE_TIME_REPORTTOKEN)) {
$this->throttleTime = $THROTTLE_TIME_REPORTTOKEN;
}
$this->throttleGroup = 'GetReportRequestListByNextToken';
$this->resetRequestIds();
$this->resetReportTypes();
$this->resetReportStatuses();
unset($this->options['MaxCount']);
unset($this->options['RequestedFromDate']);
unset($this->options['RequestedToDate']);
} else {
$this->options['Action'] = 'GetReportRequestList';
if(isset($THROTTLE_LIMIT_REPORTREQUESTLIST)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTREQUESTLIST;
}
if(isset($THROTTLE_TIME_REPORTREQUESTLIST)) {
$this->throttleTime = $THROTTLE_TIME_REPORTREQUESTLIST;
}
$this->throttleGroup = 'GetReportRequestList';
unset($this->options['NextToken']);
$this->reportList = array();
$this->index = 0;
}
} | php | protected function prepareToken(){
include($this->env);
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'GetReportRequestListByNextToken';
if(isset($THROTTLE_LIMIT_REPORTTOKEN)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTTOKEN;
}
if(isset($THROTTLE_TIME_REPORTTOKEN)) {
$this->throttleTime = $THROTTLE_TIME_REPORTTOKEN;
}
$this->throttleGroup = 'GetReportRequestListByNextToken';
$this->resetRequestIds();
$this->resetReportTypes();
$this->resetReportStatuses();
unset($this->options['MaxCount']);
unset($this->options['RequestedFromDate']);
unset($this->options['RequestedToDate']);
} else {
$this->options['Action'] = 'GetReportRequestList';
if(isset($THROTTLE_LIMIT_REPORTREQUESTLIST)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTREQUESTLIST;
}
if(isset($THROTTLE_TIME_REPORTREQUESTLIST)) {
$this->throttleTime = $THROTTLE_TIME_REPORTREQUESTLIST;
}
$this->throttleGroup = 'GetReportRequestList';
unset($this->options['NextToken']);
$this->reportList = array();
$this->index = 0;
}
} | [
"protected",
"function",
"prepareToken",
"(",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"env",
")",
";",
"if",
"(",
"$",
"this",
"->",
"tokenFlag",
"&&",
"$",
"this",
"->",
"tokenUseFlag",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"... | Sets up options for using tokens.
This changes key options for switching between simply fetching a list and
fetching the rest of a list using a token. Please note: because the
operation for using tokens does not use any other parameters, all other
parameters will be removed. | [
"Sets",
"up",
"options",
"for",
"using",
"tokens",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L304-L334 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.prepareCancel | protected function prepareCancel(){
include($this->env);
$this->options['Action'] = 'CancelReportRequests';
if(isset($THROTTLE_LIMIT_REPORTREQUESTLIST)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTREQUESTLIST;
}
if(isset($THROTTLE_TIME_REPORTREQUESTLIST)) {
$this->throttleTime = $THROTTLE_TIME_REPORTREQUESTLIST;
}
$this->throttleGroup = 'CancelReportRequests';
unset($this->options['MaxCount']);
unset($this->options['NextToken']);
} | php | protected function prepareCancel(){
include($this->env);
$this->options['Action'] = 'CancelReportRequests';
if(isset($THROTTLE_LIMIT_REPORTREQUESTLIST)) {
$this->throttleLimit = $THROTTLE_LIMIT_REPORTREQUESTLIST;
}
if(isset($THROTTLE_TIME_REPORTREQUESTLIST)) {
$this->throttleTime = $THROTTLE_TIME_REPORTREQUESTLIST;
}
$this->throttleGroup = 'CancelReportRequests';
unset($this->options['MaxCount']);
unset($this->options['NextToken']);
} | [
"protected",
"function",
"prepareCancel",
"(",
")",
"{",
"include",
"(",
"$",
"this",
"->",
"env",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
"=",
"'CancelReportRequests'",
";",
"if",
"(",
"isset",
"(",
"$",
"THROTTLE_LIMIT_REPORTREQUESTLI... | Sets up options for using <i>CancelReportRequests</i>.
This changes key options for using <i>CancelReportRequests</i>. Please note: because the
operation for cancelling feeds does not use all of the parameters, some of the
parameters will be removed. The following parameters are removed:
max count and token. | [
"Sets",
"up",
"options",
"for",
"using",
"<i",
">",
"CancelReportRequests<",
"/",
"i",
">",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L344-L356 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.parseXML | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->children() as $key=>$x){
$i = $this->index;
if ($key == 'Count'){
$this->count = (string)$x;
$this->log("Successfully canceled $this->count report requests.");
}
if ($key != 'ReportRequestInfo'){
continue;
}
$this->reportList[$i]['ReportRequestId'] = (string)$x->ReportRequestId;
$this->reportList[$i]['ReportType'] = (string)$x->ReportType;
$this->reportList[$i]['StartDate'] = (string)$x->StartDate;
$this->reportList[$i]['EndDate'] = (string)$x->EndDate;
$this->reportList[$i]['Scheduled'] = (string)$x->Scheduled;
$this->reportList[$i]['SubmittedDate'] = (string)$x->SubmittedDate;
$this->reportList[$i]['ReportProcessingStatus'] = (string)$x->ReportProcessingStatus;
$this->reportList[$i]['GeneratedReportId'] = (string)$x->GeneratedReportId;
$this->reportList[$i]['StartedProcessingDate'] = (string)$x->StartedProcessingDate;
$this->reportList[$i]['CompletedDate'] = (string)$x->CompletedDate;
$this->index++;
}
} | php | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->children() as $key=>$x){
$i = $this->index;
if ($key == 'Count'){
$this->count = (string)$x;
$this->log("Successfully canceled $this->count report requests.");
}
if ($key != 'ReportRequestInfo'){
continue;
}
$this->reportList[$i]['ReportRequestId'] = (string)$x->ReportRequestId;
$this->reportList[$i]['ReportType'] = (string)$x->ReportType;
$this->reportList[$i]['StartDate'] = (string)$x->StartDate;
$this->reportList[$i]['EndDate'] = (string)$x->EndDate;
$this->reportList[$i]['Scheduled'] = (string)$x->Scheduled;
$this->reportList[$i]['SubmittedDate'] = (string)$x->SubmittedDate;
$this->reportList[$i]['ReportProcessingStatus'] = (string)$x->ReportProcessingStatus;
$this->reportList[$i]['GeneratedReportId'] = (string)$x->GeneratedReportId;
$this->reportList[$i]['StartedProcessingDate'] = (string)$x->StartedProcessingDate;
$this->reportList[$i]['CompletedDate'] = (string)$x->CompletedDate;
$this->index++;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"xml",
"->",
"children",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"x",
")",
"{",
"$",
"i",
"... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L365-L393 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getRequestId | public function getRequestId($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportRequestId'];
} else {
return false;
}
} | php | public function getRequestId($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportRequestId'];
} else {
return false;
}
} | [
"public",
"function",
"getRequestId",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the report request ID for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"report",
"request",
"ID",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L490-L499 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getReportType | public function getReportType($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportType'];
} else {
return false;
}
} | php | public function getReportType($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportType'];
} else {
return false;
}
} | [
"public",
"function",
"getReportType",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$... | Returns the report type for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"report",
"type",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L508-L517 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getStartDate | public function getStartDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['StartDate'];
} else {
return false;
}
} | php | public function getStartDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['StartDate'];
} else {
return false;
}
} | [
"public",
"function",
"getStartDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the start date for the specified report request.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"start",
"date",
"for",
"the",
"specified",
"report",
"request",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L526-L535 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getEndDate | public function getEndDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['EndDate'];
} else {
return false;
}
} | php | public function getEndDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['EndDate'];
} else {
return false;
}
} | [
"public",
"function",
"getEndDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
... | Returns the end date for the specified report request.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"end",
"date",
"for",
"the",
"specified",
"report",
"request",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L544-L553 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getIsScheduled | public function getIsScheduled($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['Scheduled'];
} else {
return false;
}
} | php | public function getIsScheduled($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['Scheduled'];
} else {
return false;
}
} | [
"public",
"function",
"getIsScheduled",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"... | Returns whether or not the specified report request is scheduled.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"whether",
"or",
"not",
"the",
"specified",
"report",
"request",
"is",
"scheduled",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L562-L571 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getSubmittedDate | public function getSubmittedDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['SubmittedDate'];
} else {
return false;
}
} | php | public function getSubmittedDate($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['SubmittedDate'];
} else {
return false;
}
} | [
"public",
"function",
"getSubmittedDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the date the specified report request was submitted.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"date",
"the",
"specified",
"report",
"request",
"was",
"submitted",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L580-L589 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getStatus | public function getStatus($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportProcessingStatus'];
} else {
return false;
}
} | php | public function getStatus($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['ReportProcessingStatus'];
} else {
return false;
}
} | [
"public",
"function",
"getStatus",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
... | Returns the processing status for the specified report request.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"processing",
"status",
"for",
"the",
"specified",
"report",
"request",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L598-L607 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getDateProcessingStarted | public function getDateProcessingStarted($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['StartedProcessingDate'];
} else {
return false;
}
} | php | public function getDateProcessingStarted($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['StartedProcessingDate'];
} else {
return false;
}
} | [
"public",
"function",
"getDateProcessingStarted",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"re... | Returns the date processing for the specified report request started.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"date",
"processing",
"for",
"the",
"specified",
"report",
"request",
"started",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L634-L643 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getDateCompleted | public function getDateCompleted($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['CompletedDate'];
} else {
return false;
}
} | php | public function getDateCompleted($i = 0){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i]['CompletedDate'];
} else {
return false;
}
} | [
"public",
"function",
"getDateCompleted",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the date processing for the specified report request was finished.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"date",
"processing",
"for",
"the",
"specified",
"report",
"request",
"was",
"finished",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L652-L661 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonReportRequestList.php | AmazonReportRequestList.getList | public function getList($i = null){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i];
} else {
return $this->reportList;
}
} | php | public function getList($i = null){
if (!isset($this->reportList)){
return false;
}
if (is_int($i)){
return $this->reportList[$i];
} else {
return $this->reportList;
}
} | [
"public",
"function",
"getList",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"reportList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
... | Returns the full list.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single report will have the following fields:
<ul>
<li><b>ReportRequestId</b></li>
<li><b>ReportType</b></li>
<li><b>StartDate</b></li>
<li><b>EndDate</b></li>
<li><b>Scheduled</b></li>
<li><b>ReportProcessingStatus</b></li>
<li><b>GeneratedReportId</b></li>
<li><b>StartedProcessingDate</b></li>
<li><b>CompletedDate</b></li>
</ul>
@param int $i [optional] <p>List index to retrieve the value from. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"full",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonReportRequestList.php#L693-L703 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonSubscriptionDestinationList.php | AmazonSubscriptionDestinationList.parseXML | protected function parseXML($xml){
$this->destinationList = array();
if (!$xml){
return false;
}
$i = 0;
foreach ($xml->DestinationList->children() as $item) {
$this->destinationList[$i]['DeliveryChannel'] = (string)$item->DeliveryChannel;
foreach ($item->AttributeList->children() as $member) {
$this->destinationList[$i]['AttributeList'][(string)$member->Key] = (string)$member->Value;
}
$i++;
}
} | php | protected function parseXML($xml){
$this->destinationList = array();
if (!$xml){
return false;
}
$i = 0;
foreach ($xml->DestinationList->children() as $item) {
$this->destinationList[$i]['DeliveryChannel'] = (string)$item->DeliveryChannel;
foreach ($item->AttributeList->children() as $member) {
$this->destinationList[$i]['AttributeList'][(string)$member->Key] = (string)$member->Value;
}
$i++;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"$",
"this",
"->",
"destinationList",
"=",
"array",
"(",
")",
";",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonSubscriptionDestinationList.php#L75-L91 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonSubscriptionDestinationList.php | AmazonSubscriptionDestinationList.getDestinations | public function getDestinations($i = null){
if (isset($this->destinationList)){
if (is_numeric($i)){
return $this->destinationList[$i];
} else {
return $this->destinationList;
}
} else {
return false;
}
} | php | public function getDestinations($i = null){
if (isset($this->destinationList)){
if (is_numeric($i)){
return $this->destinationList[$i];
} else {
return $this->destinationList;
}
} else {
return false;
}
} | [
"public",
"function",
"getDestinations",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"destinationList",
")",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
"this",
"->",
"destin... | Returns the specified destination, or all of them.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single order item will have the following fields:
<ul>
<li><b>DeliveryChannel</b> - the technology used to receive notifications</li>
<li><b>AttributeList</b> - array of key/value pairs</li>
</ul>
@param int $i [optional] <p>List index to retrieve the value from.
If none is given, the entire list will be returned. Defaults to NULL.</p>
@return array|boolean array, multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"specified",
"destination",
"or",
"all",
"of",
"them",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonSubscriptionDestinationList.php#L106-L116 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonSubscriptionDestinationList.php | AmazonSubscriptionDestinationList.getDeliveryChannel | public function getDeliveryChannel($i = 0){
if (isset($this->destinationList[$i]['DeliveryChannel'])){
return $this->destinationList[$i]['DeliveryChannel'];
} else {
return false;
}
} | php | public function getDeliveryChannel($i = 0){
if (isset($this->destinationList[$i]['DeliveryChannel'])){
return $this->destinationList[$i]['DeliveryChannel'];
} else {
return false;
}
} | [
"public",
"function",
"getDeliveryChannel",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"destinationList",
"[",
"$",
"i",
"]",
"[",
"'DeliveryChannel'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"destinationLis... | Returns the delivery channel for the specified entry.
Possible values for this field: "SQS".
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"delivery",
"channel",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonSubscriptionDestinationList.php#L126-L132 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonSubscriptionDestinationList.php | AmazonSubscriptionDestinationList.getAttributes | public function getAttributes($i = 0, $j = null){
if (isset($this->destinationList[$i]['AttributeList'])){
if (isset($this->destinationList[$i]['AttributeList'][$j])){
return $this->destinationList[$i]['AttributeList'][$j];
} else {
return $this->destinationList[$i]['AttributeList'];
}
} else {
return false;
}
} | php | public function getAttributes($i = 0, $j = null){
if (isset($this->destinationList[$i]['AttributeList'])){
if (isset($this->destinationList[$i]['AttributeList'][$j])){
return $this->destinationList[$i]['AttributeList'][$j];
} else {
return $this->destinationList[$i]['AttributeList'];
}
} else {
return false;
}
} | [
"public",
"function",
"getAttributes",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"j",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"destinationList",
"[",
"$",
"i",
"]",
"[",
"'AttributeList'",
"]",
")",
")",
"{",
"if",
"(",
"isset... | Returns the specified attribute set for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@param string $j [optional] <p>Second list index to retrieve the value from. Defaults to NULL.</p>
@return array|boolean associative array, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"specified",
"attribute",
"set",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonSubscriptionDestinationList.php#L142-L152 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.setUseToken | public function setUseToken($b = true){
if (is_bool($b)){
$this->tokenUseFlag = $b;
$this->tokenItemFlag = $b;
} else {
return false;
}
} | php | public function setUseToken($b = true){
if (is_bool($b)){
$this->tokenUseFlag = $b;
$this->tokenItemFlag = $b;
} else {
return false;
}
} | [
"public",
"function",
"setUseToken",
"(",
"$",
"b",
"=",
"true",
")",
"{",
"if",
"(",
"is_bool",
"(",
"$",
"b",
")",
")",
"{",
"$",
"this",
"->",
"tokenUseFlag",
"=",
"$",
"b",
";",
"$",
"this",
"->",
"tokenItemFlag",
"=",
"$",
"b",
";",
"}",
"... | Sets whether or not the object should automatically use tokens if it receives one.
If this option is set to <b>TRUE</b>, the object will automatically perform
the necessary operations to retrieve the rest of the list using tokens. If
this option is off, the object will only ever retrieve the first section of
the list.
@param boolean $b [optional] <p>Defaults to <b>TRUE</b></p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"whether",
"or",
"not",
"the",
"object",
"should",
"automatically",
"use",
"tokens",
"if",
"it",
"receives",
"one",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L75-L82 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.prepareToken | protected function prepareToken(){
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'ListInboundShipmentItemsByNextToken';
} else {
unset($this->options['NextToken']);
$this->options['Action'] = 'ListInboundShipmentItems';
$this->index = 0;
$this->itemList = array();
}
} | php | protected function prepareToken(){
if ($this->tokenFlag && $this->tokenUseFlag){
$this->options['Action'] = 'ListInboundShipmentItemsByNextToken';
} else {
unset($this->options['NextToken']);
$this->options['Action'] = 'ListInboundShipmentItems';
$this->index = 0;
$this->itemList = array();
}
} | [
"protected",
"function",
"prepareToken",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tokenFlag",
"&&",
"$",
"this",
"->",
"tokenUseFlag",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'Action'",
"]",
"=",
"'ListInboundShipmentItemsByNextToken'",
";",
"}",
... | Sets up options for using tokens.
This changes key options for switching between simply fetching a list and
fetching the rest of a list using a token. Please note: because the
operation for using tokens does not use any other parameters, all other
parameters will be removed. | [
"Sets",
"up",
"options",
"for",
"using",
"tokens",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L205-L214 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.parseXML | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->ItemData->children() as $x){
$a = array();
if (isset($x->ShipmentId)){
$a['ShipmentId'] = (string)$x->ShipmentId;
}
$a['SellerSKU'] = (string)$x->SellerSKU;
if (isset($x->FulfillmentNetworkSKU)){
$a['FulfillmentNetworkSKU'] = (string)$x->FulfillmentNetworkSKU;
}
$a['QuantityShipped'] = (string)$x->QuantityShipped;
if (isset($x->QuantityReceived)){
$a['QuantityReceived'] = (string)$x->QuantityReceived;
}
if (isset($x->QuantityInCase)){
$a['QuantityInCase'] = (string)$x->QuantityInCase;
}
if (isset($x->PrepDetailsList)) {
foreach ($x->PrepDetailsList->children() as $z) {
$temp = array();
$temp['PrepInstruction'] = (string)$z->PrepInstruction;
$temp['PrepOwner'] = (string)$z->PrepOwner;
$a['PrepDetailsList'][] = $temp;
}
}
if (isset($x->ReleaseDate)){
$a['ReleaseDate'] = (string)$x->ReleaseDate;
}
$this->itemList[$this->index] = $a;
$this->index++;
}
} | php | protected function parseXML($xml){
if (!$xml){
return false;
}
foreach($xml->ItemData->children() as $x){
$a = array();
if (isset($x->ShipmentId)){
$a['ShipmentId'] = (string)$x->ShipmentId;
}
$a['SellerSKU'] = (string)$x->SellerSKU;
if (isset($x->FulfillmentNetworkSKU)){
$a['FulfillmentNetworkSKU'] = (string)$x->FulfillmentNetworkSKU;
}
$a['QuantityShipped'] = (string)$x->QuantityShipped;
if (isset($x->QuantityReceived)){
$a['QuantityReceived'] = (string)$x->QuantityReceived;
}
if (isset($x->QuantityInCase)){
$a['QuantityInCase'] = (string)$x->QuantityInCase;
}
if (isset($x->PrepDetailsList)) {
foreach ($x->PrepDetailsList->children() as $z) {
$temp = array();
$temp['PrepInstruction'] = (string)$z->PrepInstruction;
$temp['PrepOwner'] = (string)$z->PrepOwner;
$a['PrepDetailsList'][] = $temp;
}
}
if (isset($x->ReleaseDate)){
$a['ReleaseDate'] = (string)$x->ReleaseDate;
}
$this->itemList[$this->index] = $a;
$this->index++;
}
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"xml",
"->",
"ItemData",
"->",
"children",
"(",
")",
"as",
"$",
"x",
")",
"{",
"$",
"a",
"="... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L223-L259 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getShipmentId | public function getShipmentId($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['ShipmentId'];
} else {
return false;
}
} | php | public function getShipmentId($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['ShipmentId'];
} else {
return false;
}
} | [
"public",
"function",
"getShipmentId",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",... | Returns the shipment ID for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"shipment",
"ID",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L268-L277 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getSellerSKU | public function getSellerSKU($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['SellerSKU'];
} else {
return false;
}
} | php | public function getSellerSKU($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['SellerSKU'];
} else {
return false;
}
} | [
"public",
"function",
"getSellerSKU",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
... | Returns the seller SKU for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"seller",
"SKU",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L286-L295 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getFulfillmentNetworkSKU | public function getFulfillmentNetworkSKU($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['FulfillmentNetworkSKU'];
} else {
return false;
}
} | php | public function getFulfillmentNetworkSKU($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['FulfillmentNetworkSKU'];
} else {
return false;
}
} | [
"public",
"function",
"getFulfillmentNetworkSKU",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"retu... | Returns the Fulfillment Network SKU for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"Fulfillment",
"Network",
"SKU",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L304-L313 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getQuantityReceived | public function getQuantityReceived($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['QuantityReceived'];
} else {
return false;
}
} | php | public function getQuantityReceived($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['QuantityReceived'];
} else {
return false;
}
} | [
"public",
"function",
"getQuantityReceived",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the quantity received for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"quantity",
"received",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L340-L349 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getQuantityInCase | public function getQuantityInCase($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['QuantityInCase'];
} else {
return false;
}
} | php | public function getQuantityInCase($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['QuantityInCase'];
} else {
return false;
}
} | [
"public",
"function",
"getQuantityInCase",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
... | Returns the quantity in cases for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"quantity",
"in",
"cases",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L358-L367 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getPrepDetails | public function getPrepDetails($i = 0, $j = null) {
if (!isset($this->itemList)){
return false;
}
if (is_int($i) && isset($this->itemList[$i]['PrepDetailsList'])){
if (is_numeric($j)) {
return $this->itemList[$i]['PrepDetailsList'][$j];
} else {
return $this->itemList[$i]['PrepDetailsList'];
}
} else {
return false;
}
} | php | public function getPrepDetails($i = 0, $j = null) {
if (!isset($this->itemList)){
return false;
}
if (is_int($i) && isset($this->itemList[$i]['PrepDetailsList'])){
if (is_numeric($j)) {
return $this->itemList[$i]['PrepDetailsList'][$j];
} else {
return $this->itemList[$i]['PrepDetailsList'];
}
} else {
return false;
}
} | [
"public",
"function",
"getPrepDetails",
"(",
"$",
"i",
"=",
"0",
",",
"$",
"j",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
... | Returns the preperation details for the specified entry.
Each individual preperation detail entry is an array with the keys "PrepInstruction" and "PrepOwner".
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@param int $j [optional] <p>Detail index to retrieve the value from. Defaults to NULL.</p>
@return array|boolean associative array, array of associative arrays, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"preperation",
"details",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L378-L391 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getReleaseDate | public function getReleaseDate($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['ReleaseDate'];
} else {
return false;
}
} | php | public function getReleaseDate($i = 0){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i]['ReleaseDate'];
} else {
return false;
}
} | [
"public",
"function",
"getReleaseDate",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the release date for the specified entry.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean Date in YYYY-MM-DD format, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"release",
"date",
"for",
"the",
"specified",
"entry",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L400-L409 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonShipmentItemList.php | AmazonShipmentItemList.getItems | public function getItems($i = null){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i];
} else {
return $this->itemList;
}
} | php | public function getItems($i = null){
if (!isset($this->itemList)){
return false;
}
if (is_int($i)){
return $this->itemList[$i];
} else {
return $this->itemList;
}
} | [
"public",
"function",
"getItems",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"itemList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$",
... | Returns the full list.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single shipment item will have the following fields:
<ul>
<li><b>ShipmentId</b></li>
<li><b>SellerSKU</b></li>
<li><b>FulfillmentNetworkSKU</b></li>
<li><b>QuantityShipped</b></li>
<li><b>QuantityReceived</b></li>
<li><b>QuantityInCase</b></li>
</ul>
@param int $i [optional] <p>List index of the item to return. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"full",
"list",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonShipmentItemList.php#L427-L436 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.setSkus | public function setSkus($s){
if (is_string($s)){
$s = array($s);
}
if (is_array($s)){
$this->resetASINs();
$this->resetSKUs();
$i = 1;
foreach ($s as $x){
$this->options['SellerSKUList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setSkus($s){
if (is_string($s)){
$s = array($s);
}
if (is_array($s)){
$this->resetASINs();
$this->resetSKUs();
$i = 1;
foreach ($s as $x){
$this->options['SellerSKUList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setSkus",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"s",
"=",
"array",
"(",
"$",
"s",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
... | Sets the seller SKU(s). (Required*)
This method sets the list of seller SKUs to be sent in the next request.
If this parameter is set, ASINs cannot be set.
@param array|string $s <p>A list of Seller SKUs, or a single SKU string. (max: 20)</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"seller",
"SKU",
"(",
"s",
")",
".",
"(",
"Required",
"*",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L39-L54 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.resetAsins | private function resetAsins(){
foreach($this->options as $op=>$junk){
if(preg_match("#ASINList#",$op)){
unset($this->options[$op]);
}
}
} | php | private function resetAsins(){
foreach($this->options as $op=>$junk){
if(preg_match("#ASINList#",$op)){
unset($this->options[$op]);
}
}
} | [
"private",
"function",
"resetAsins",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#ASINList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"(",
"$",
"this"... | Resets the ASIN options.
Since ASIN is a required parameter, these options should not be removed
without replacing them, so this method is not public. | [
"Resets",
"the",
"ASIN",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L101-L107 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.preparePrep | protected function preparePrep(){
$this->prepList = array();
$this->invalidList = array();
$this->rewind();
if (array_key_exists('SellerSKUList.Id.1',$this->options)){
$this->options['Action'] = 'GetPrepInstructionsForSKU';
$this->resetASINs();
} else if (array_key_exists('ASINList.Id.1',$this->options)){
$this->options['Action'] = 'GetPrepInstructionsForASIN';
$this->resetSKUs();
}
} | php | protected function preparePrep(){
$this->prepList = array();
$this->invalidList = array();
$this->rewind();
if (array_key_exists('SellerSKUList.Id.1',$this->options)){
$this->options['Action'] = 'GetPrepInstructionsForSKU';
$this->resetASINs();
} else if (array_key_exists('ASINList.Id.1',$this->options)){
$this->options['Action'] = 'GetPrepInstructionsForASIN';
$this->resetSKUs();
}
} | [
"protected",
"function",
"preparePrep",
"(",
")",
"{",
"$",
"this",
"->",
"prepList",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"invalidList",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"rewind",
"(",
")",
";",
"if",
"(",
"array_key_exists... | Sets up options for using <i>fetchPrepInstructions</i>.
This changes key options for using <i>fetchPrepInstructions</i>. | [
"Sets",
"up",
"options",
"for",
"using",
"<i",
">",
"fetchPrepInstructions<",
"/",
"i",
">",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L155-L166 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.parseXml | protected function parseXml($xml) {
if (!$xml){
return false;
}
//SKU or ASIN list
$list = false;
if (isset($xml->SKUPrepInstructionsList)) {
$list = $xml->SKUPrepInstructionsList;
}
if (isset($xml->ASINPrepInstructionsList)) {
$list = $xml->ASINPrepInstructionsList;
}
if ($list) {
foreach ($list->children() as $x) {
$temp = array();
if (isset($x->SellerSKU)) {
$temp['SellerSKU'] = (string)$x->SellerSKU;
}
$temp['ASIN'] = (string)$x->ASIN;
$temp['BarcodeInstruction'] = (string)$x->BarcodeInstruction;
$temp['PrepGuidance'] = (string)$x->PrepGuidance;
foreach ($x->PrepInstructionList->children() as $z) {
$temp['PrepInstructionList'][] = (string)$z;
}
if (isset($x->AmazonPrepFeesDetailsList)) {
foreach ($x->AmazonPrepFeesDetailsList->children() as $z) {
$fee = array();
$fee['PrepInstruction'] = (string)$z->PrepInstruction;
$fee['Amount']['Value'] = (string)$z->Amount->Value;
$fee['Amount']['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
$temp['AmazonPrepFees'][] = $fee;
}
}
$this->prepList[] = $temp;
}
}
//invalid item list
$invList = false;
if (isset($xml->InvalidSKUList)) {
$invList = $xml->InvalidSKUList;
}
if (isset($xml->InvalidASINList)) {
$invList = $xml->InvalidASINList;
}
if ($invList) {
foreach ($invList->children() as $x) {
$temp = array();
$temp['ErrorReason'] = (string)$x->ErrorReason;
if (isset($x->SellerSKU)) {
$temp['SellerSKU'] = (string)$x->SellerSKU;
}
if (isset($x->ASIN)) {
$temp['ASIN'] = (string)$x->ASIN;
}
$this->invalidList[] = $temp;
}
}
} | php | protected function parseXml($xml) {
if (!$xml){
return false;
}
//SKU or ASIN list
$list = false;
if (isset($xml->SKUPrepInstructionsList)) {
$list = $xml->SKUPrepInstructionsList;
}
if (isset($xml->ASINPrepInstructionsList)) {
$list = $xml->ASINPrepInstructionsList;
}
if ($list) {
foreach ($list->children() as $x) {
$temp = array();
if (isset($x->SellerSKU)) {
$temp['SellerSKU'] = (string)$x->SellerSKU;
}
$temp['ASIN'] = (string)$x->ASIN;
$temp['BarcodeInstruction'] = (string)$x->BarcodeInstruction;
$temp['PrepGuidance'] = (string)$x->PrepGuidance;
foreach ($x->PrepInstructionList->children() as $z) {
$temp['PrepInstructionList'][] = (string)$z;
}
if (isset($x->AmazonPrepFeesDetailsList)) {
foreach ($x->AmazonPrepFeesDetailsList->children() as $z) {
$fee = array();
$fee['PrepInstruction'] = (string)$z->PrepInstruction;
$fee['Amount']['Value'] = (string)$z->Amount->Value;
$fee['Amount']['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
$temp['AmazonPrepFees'][] = $fee;
}
}
$this->prepList[] = $temp;
}
}
//invalid item list
$invList = false;
if (isset($xml->InvalidSKUList)) {
$invList = $xml->InvalidSKUList;
}
if (isset($xml->InvalidASINList)) {
$invList = $xml->InvalidASINList;
}
if ($invList) {
foreach ($invList->children() as $x) {
$temp = array();
$temp['ErrorReason'] = (string)$x->ErrorReason;
if (isset($x->SellerSKU)) {
$temp['SellerSKU'] = (string)$x->SellerSKU;
}
if (isset($x->ASIN)) {
$temp['ASIN'] = (string)$x->ASIN;
}
$this->invalidList[] = $temp;
}
}
} | [
"protected",
"function",
"parseXml",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"//SKU or ASIN list",
"$",
"list",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"xml",
"->",
"SKUPrepInstructionsList... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L175-L234 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getSku | public function getSku($i = 0){
if (isset($this->prepList[$i]['SellerSKU'])){
return $this->prepList[$i]['SellerSKU'];
} else {
return false;
}
} | php | public function getSku($i = 0){
if (isset($this->prepList[$i]['SellerSKU'])){
return $this->prepList[$i]['SellerSKU'];
} else {
return false;
}
} | [
"public",
"function",
"getSku",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'SellerSKU'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
... | Returns the Seller SKU for the specified item preperation instruction.
Prep instructions will only include this data if SKUs were sent when
retrieving the list of prep instructions.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"Seller",
"SKU",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L245-L251 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getAsin | public function getAsin($i = 0){
if (isset($this->prepList[$i]['ASIN'])){
return $this->prepList[$i]['ASIN'];
} else {
return false;
}
} | php | public function getAsin($i = 0){
if (isset($this->prepList[$i]['ASIN'])){
return $this->prepList[$i]['ASIN'];
} else {
return false;
}
} | [
"public",
"function",
"getAsin",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'ASIN'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[... | Returns the ASIN for the specified item preperation instruction.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"ASIN",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L260-L266 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getBarcodeInstruction | public function getBarcodeInstruction($i = 0){
if (isset($this->prepList[$i]['BarcodeInstruction'])){
return $this->prepList[$i]['BarcodeInstruction'];
} else {
return false;
}
} | php | public function getBarcodeInstruction($i = 0){
if (isset($this->prepList[$i]['BarcodeInstruction'])){
return $this->prepList[$i]['BarcodeInstruction'];
} else {
return false;
}
} | [
"public",
"function",
"getBarcodeInstruction",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'BarcodeInstruction'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"[... | Returns the barcode instruction for the specified item preperation instruction.
Possible values are "RequiresFNSKULabel" and "CanUseOriginalBarcode".
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"barcode",
"instruction",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L276-L282 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getPrepGuidance | public function getPrepGuidance($i = 0){
if (isset($this->prepList[$i]['PrepGuidance'])){
return $this->prepList[$i]['PrepGuidance'];
} else {
return false;
}
} | php | public function getPrepGuidance($i = 0){
if (isset($this->prepList[$i]['PrepGuidance'])){
return $this->prepList[$i]['PrepGuidance'];
} else {
return false;
}
} | [
"public",
"function",
"getPrepGuidance",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'PrepGuidance'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"[",
"$",
... | Returns the prep guidance message for the specified item preperation instruction.
Possible values are "ConsultHelpDocuments", "NoAdditionalPrepRequired",
and "SeePrepInstructionsList".
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return string|boolean single value, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"prep",
"guidance",
"message",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L293-L299 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getPrepInstructions | public function getPrepInstructions($i = 0){
if (isset($this->prepList[$i]['PrepInstructionList'])){
return $this->prepList[$i]['PrepInstructionList'];
} else {
return false;
}
} | php | public function getPrepInstructions($i = 0){
if (isset($this->prepList[$i]['PrepInstructionList'])){
return $this->prepList[$i]['PrepInstructionList'];
} else {
return false;
}
} | [
"public",
"function",
"getPrepInstructions",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'PrepInstructionList'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"["... | Returns the list of instructions for the specified item preperation instruction.
Possible values are "Polybagging", "BubbleWrapping", "Taping", "BlackShrinkWrapping",
"Labeling", and "HangGarment".
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return array|boolean simple array, or <b>FALSE</b> if Non-numeric index | [
"Returns",
"the",
"list",
"of",
"instructions",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L310-L316 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getAmazonPrepFees | public function getAmazonPrepFees($i = 0){
if (isset($this->prepList[$i]['AmazonPrepFees'])){
return $this->prepList[$i]['AmazonPrepFees'];
} else {
return false;
}
} | php | public function getAmazonPrepFees($i = 0){
if (isset($this->prepList[$i]['AmazonPrepFees'])){
return $this->prepList[$i]['AmazonPrepFees'];
} else {
return false;
}
} | [
"public",
"function",
"getAmazonPrepFees",
"(",
"$",
"i",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"prepList",
"[",
"$",
"i",
"]",
"[",
"'AmazonPrepFees'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"prepList",
"[",
"$"... | Returns the list of instructions for the specified item preperation instruction.
The array for a single fee will have the following fields:
<ul>
<li><b>PrepInstruction</b> - see getPrepInstructions for possible values</li>
<li><b>FeePerUnit</b> - array</li>
<ul>
<li><b>Value</b> - number</li>
<li><b>CurrencyCode</b> - ISO 4217 currency code</li>
</ul>
</ul>
Prep instructions will only include this data if SKUs were sent when
retrieving the list of prep instructions.
This method will return <b>FALSE</b> if the list has not yet been filled.
@param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if Non-numeric index
@see getPrepInstructions | [
"Returns",
"the",
"list",
"of",
"instructions",
"for",
"the",
"specified",
"item",
"preperation",
"instruction",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L337-L343 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getPrepList | public function getPrepList($i = null){
if (!isset($this->prepList)){
return false;
}
if (is_int($i)){
return $this->prepList[$i];
} else {
return $this->prepList;
}
} | php | public function getPrepList($i = null){
if (!isset($this->prepList)){
return false;
}
if (is_int($i)){
return $this->prepList[$i];
} else {
return $this->prepList;
}
} | [
"public",
"function",
"getPrepList",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"prepList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"return",
"$"... | Returns the full list of preperation instructions.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single instruction will have the following fields:
<ul>
<li><b>SellerSKU</b></li>
<li><b>ASIN</b></li>
<li><b>BarcodeInstruction</b></li>
<li><b>PrepGuidance</b></li>
<li><b>PrepInstructionList</b> (see <i>getPrepInstructions</i> for details)</li>
<li><b>AmazonPrepFees</b> (see <i>getAmazonPrepFees</i> for details)</li>
</ul>
@param int $i [optional] <p>List index of the instruction to return. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet
@see getPrepInstructionList
@see getAmazonPrepFees | [
"Returns",
"the",
"full",
"list",
"of",
"preperation",
"instructions",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L363-L372 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonPrepInfo.php | AmazonPrepInfo.getInvalidItemList | public function getInvalidItemList($i = null){
if (!isset($this->invalidList)){
return false;
}
if (is_int($i)){
return $this->invalidList[$i];
} else {
return $this->invalidList;
}
} | php | public function getInvalidItemList($i = null){
if (!isset($this->invalidList)){
return false;
}
if (is_int($i)){
return $this->invalidList[$i];
} else {
return $this->invalidList;
}
} | [
"public",
"function",
"getInvalidItemList",
"(",
"$",
"i",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"invalidList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"i",
")",
")",
"{",
"retu... | Returns the full list of invalid items.
This method will return <b>FALSE</b> if the list has not yet been filled.
The array for a single item will have the following fields:
<ul>
<li><b>SellerSKU</b> or <b>ASIN</b></li>
<li><b>ErrorReason</b></li>
</ul>
@param int $i [optional] <p>List index of the item to return. Defaults to NULL.</p>
@return array|boolean multi-dimensional array, or <b>FALSE</b> if list not filled yet | [
"Returns",
"the",
"full",
"list",
"of",
"invalid",
"items",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonPrepInfo.php#L386-L395 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.setFeedContent | public function setFeedContent($s){
if (is_string($s) && $s){
$this->feedContent=$s;
$this->feedMD5 = base64_encode(md5($this->feedContent,true));
} else {
return false;
}
} | php | public function setFeedContent($s){
if (is_string($s) && $s){
$this->feedContent=$s;
$this->feedMD5 = base64_encode(md5($this->feedContent,true));
} else {
return false;
}
} | [
"public",
"function",
"setFeedContent",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"s",
")",
"&&",
"$",
"s",
")",
"{",
"$",
"this",
"->",
"feedContent",
"=",
"$",
"s",
";",
"$",
"this",
"->",
"feedMD5",
"=",
"base64_encode",
"(",
... | Sets the Feed Content. (Required)
Thie method sets the feed's contents from direct input.
This parameter is required in order to submit a feed to Amazon.
@param string $s <p>The contents to put in the file.</p>
It can be relative or absolute.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"Feed",
"Content",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L69-L76 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.loadFeedFile | public function loadFeedFile($path){
if (file_exists($path)){
if (strpos($path, '/') == 0){
$this->feedContent = file_get_contents($path);
} else {
$url = __DIR__.'/../../'.$path; //todo: change to current install dir
$this->feedContent = file_get_contents($url);
}
$this->feedMD5 = base64_encode(md5($this->feedContent,true));
}
} | php | public function loadFeedFile($path){
if (file_exists($path)){
if (strpos($path, '/') == 0){
$this->feedContent = file_get_contents($path);
} else {
$url = __DIR__.'/../../'.$path; //todo: change to current install dir
$this->feedContent = file_get_contents($url);
}
$this->feedMD5 = base64_encode(md5($this->feedContent,true));
}
} | [
"public",
"function",
"loadFeedFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'/'",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"feedContent",
"=",
"file... | Sets the Feed Content. (Required)
This method loads the contents of a file to send as the feed. This
parameter is required in order to submit a feed to Amazon.
@param string $path <p>The path to a file you want to use.
It can be relative or absolute.</p> | [
"Sets",
"the",
"Feed",
"Content",
".",
"(",
"Required",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L86-L96 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.setMarketplaceIds | public function setMarketplaceIds($s){
if ($s && is_string($s)){
$this->resetMarketplaceIds();
$this->options['MarketplaceIdList.Id.1'] = $s;
} else if ($s && is_array($s)){
$this->resetMarketplaceIds();
$i = 1;
foreach ($s as $x){
$this->options['MarketplaceIdList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setMarketplaceIds($s){
if ($s && is_string($s)){
$this->resetMarketplaceIds();
$this->options['MarketplaceIdList.Id.1'] = $s;
} else if ($s && is_array($s)){
$this->resetMarketplaceIds();
$i = 1;
foreach ($s as $x){
$this->options['MarketplaceIdList.Id.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setMarketplaceIds",
"(",
"$",
"s",
")",
"{",
"if",
"(",
"$",
"s",
"&&",
"is_string",
"(",
"$",
"s",
")",
")",
"{",
"$",
"this",
"->",
"resetMarketplaceIds",
"(",
")",
";",
"$",
"this",
"->",
"options",
"[",
"'MarketplaceIdList.Id... | Sets the request ID(s). (Optional)
This method sets the list of Marketplace IDs to be sent in the next request.
Setting this parameter tells Amazon to apply the Feed to more than one
Marketplace. These should be IDs for Marketplaces that you are registered
to sell in. If this is not set, Amazon will only use the first Marketplace
you are registered for.
@param array|string $s <p>A list of Marketplace IDs, or a single ID string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"request",
"ID",
"(",
"s",
")",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L167-L181 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.resetMarketplaceIds | public function resetMarketplaceIds(){
foreach($this->options as $op=>$junk){
if(preg_match("#MarketplaceIdList#",$op)){
unset($this->options[$op]);
}
}
} | php | public function resetMarketplaceIds(){
foreach($this->options as $op=>$junk){
if(preg_match("#MarketplaceIdList#",$op)){
unset($this->options[$op]);
}
}
} | [
"public",
"function",
"resetMarketplaceIds",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"as",
"$",
"op",
"=>",
"$",
"junk",
")",
"{",
"if",
"(",
"preg_match",
"(",
"\"#MarketplaceIdList#\"",
",",
"$",
"op",
")",
")",
"{",
"unset",
"("... | Removes ID options.
Use this in case you change your mind and want to remove the Marketplace ID
parameters you previously set. | [
"Removes",
"ID",
"options",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L189-L195 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.setPurge | public function setPurge($s = 'true'){
if ($s == 'true' || ($s && is_bool($s))){
$this->log("Caution! Purge mode set!",'Warning');
$this->options['PurgeAndReplace'] = 'true';
$this->throttleTime = 86400;
} else if ($s == 'false' || (!$s && is_bool($s))){
$this->log("Purge mode deactivated.");
$this->options['PurgeAndReplace'] = 'false';
include($this->env);
if(isset($THROTTLE_TIME_FEEDSUBMIT)) {
$this->throttleTime = $THROTTLE_TIME_FEEDSUBMIT;
}
} else {
return false;
}
} | php | public function setPurge($s = 'true'){
if ($s == 'true' || ($s && is_bool($s))){
$this->log("Caution! Purge mode set!",'Warning');
$this->options['PurgeAndReplace'] = 'true';
$this->throttleTime = 86400;
} else if ($s == 'false' || (!$s && is_bool($s))){
$this->log("Purge mode deactivated.");
$this->options['PurgeAndReplace'] = 'false';
include($this->env);
if(isset($THROTTLE_TIME_FEEDSUBMIT)) {
$this->throttleTime = $THROTTLE_TIME_FEEDSUBMIT;
}
} else {
return false;
}
} | [
"public",
"function",
"setPurge",
"(",
"$",
"s",
"=",
"'true'",
")",
"{",
"if",
"(",
"$",
"s",
"==",
"'true'",
"||",
"(",
"$",
"s",
"&&",
"is_bool",
"(",
"$",
"s",
")",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Caution! Purge mode set!\"",
... | Turns on or off Purge mode. (Optional)
<b>Warning! This parameter can only be used once every 24 hours!</b>
This method sets whether or not the tab delimited feed you provide should
completely replace old data. Use this parameter only in exceptional cases.
If this is not set, Amazon assumes it to be false.
@param boolean|string $s [optional] <p>The value "true" or "false", either as
a boolean or a string. It defaults to "true".</p>
@return boolean <b>FALSE</b> if improper input | [
"Turns",
"on",
"or",
"off",
"Purge",
"mode",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L210-L225 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.submitFeed | public function submitFeed(){
if (!$this->feedContent){
$this->log("Feed's contents must be set in order to submit it!",'Warning');
return false;
}
if (!array_key_exists('FeedType',$this->options)){
$this->log("Feed Type must be set in order to submit a feed!",'Warning');
return false;
}
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile()->$path;
} else {
$headers = $this->genHeader();
$response = $this->sendRequest("$url?$query",array('Header'=>$headers,'Post'=>$this->feedContent));
if (!$this->checkResponse($response)){
return false;
}
if (isset($response['code']) && $response['code'] == '200'){
$body = strstr($response['body'],'<');
$xml = simplexml_load_string($body)->$path;
} else {
$this->log("Unexpected response: ".print_r($response,true),'Warning');
$xml = simplexml_load_string($response['body'])->$path;
}
}
$this->parseXML($xml->FeedSubmissionInfo);
} | php | public function submitFeed(){
if (!$this->feedContent){
$this->log("Feed's contents must be set in order to submit it!",'Warning');
return false;
}
if (!array_key_exists('FeedType',$this->options)){
$this->log("Feed Type must be set in order to submit a feed!",'Warning');
return false;
}
$url = $this->urlbase.$this->urlbranch;
$query = $this->genQuery();
$path = $this->options['Action'].'Result';
if ($this->mockMode){
$xml = $this->fetchMockFile()->$path;
} else {
$headers = $this->genHeader();
$response = $this->sendRequest("$url?$query",array('Header'=>$headers,'Post'=>$this->feedContent));
if (!$this->checkResponse($response)){
return false;
}
if (isset($response['code']) && $response['code'] == '200'){
$body = strstr($response['body'],'<');
$xml = simplexml_load_string($body)->$path;
} else {
$this->log("Unexpected response: ".print_r($response,true),'Warning');
$xml = simplexml_load_string($response['body'])->$path;
}
}
$this->parseXML($xml->FeedSubmissionInfo);
} | [
"public",
"function",
"submitFeed",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"feedContent",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"\"Feed's contents must be set in order to submit it!\"",
",",
"'Warning'",
")",
";",
"return",
"false",
";",
"}",
"... | Submits a feed to Amazon.
Submits a <i>SubmitFeed</i> request to Amazon. In order to do this, both
the feed's contents and feed type are required. The request will not be
sent if either of these are not set. Amazon will send a response back,
which can be retrieved using <i>getResponse</i>.
@return boolean <b>FALSE</b> if something goes wrong | [
"Submits",
"a",
"feed",
"to",
"Amazon",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L236-L274 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonFeed.php | AmazonFeed.parseXML | protected function parseXML($xml){
if (!$xml){
return false;
}
$this->response = array();
$this->response['FeedSubmissionId'] = (string)$xml->FeedSubmissionId;
$this->response['FeedType'] = (string)$xml->FeedType;
$this->response['SubmittedDate'] = (string)$xml->SubmittedDate;
$this->response['FeedProcessingStatus'] = (string)$xml->FeedProcessingStatus;
$this->log("Successfully submitted feed #".$this->response['FeedSubmissionId'].' ('.$this->response['FeedType'].')');
} | php | protected function parseXML($xml){
if (!$xml){
return false;
}
$this->response = array();
$this->response['FeedSubmissionId'] = (string)$xml->FeedSubmissionId;
$this->response['FeedType'] = (string)$xml->FeedType;
$this->response['SubmittedDate'] = (string)$xml->SubmittedDate;
$this->response['FeedProcessingStatus'] = (string)$xml->FeedProcessingStatus;
$this->log("Successfully submitted feed #".$this->response['FeedSubmissionId'].' ('.$this->response['FeedType'].')');
} | [
"protected",
"function",
"parseXML",
"(",
"$",
"xml",
")",
"{",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"response",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"response",
"[",
"'FeedSubmissionId'",
... | Parses XML response into array.
This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found | [
"Parses",
"XML",
"response",
"into",
"array",
"."
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonFeed.php#L283-L295 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonOrderList.php | AmazonOrderList.setLimits | public function setLimits($mode,$lower = null,$upper = null){
try{
if ($upper){
$before = $this->genTime($upper);
} else {
$before = $this->genTime('- 2 min');
}
if ($lower){
$after = $this->genTime($lower);
} else {
$after = $this->genTime('- 2 min');
}
if ($after > $before){
$after = $this->genTime($upper.' - 150 sec');
}
if ($mode == 'Created'){
$this->options['CreatedAfter'] = $after;
if ($before) {
$this->options['CreatedBefore'] = $before;
}
unset($this->options['LastUpdatedAfter']);
unset($this->options['LastUpdatedBefore']);
} else if ($mode == 'Modified'){
$this->options['LastUpdatedAfter'] = $after;
if ($before){
$this->options['LastUpdatedBefore'] = $before;
}
unset($this->options['CreatedAfter']);
unset($this->options['CreatedBefore']);
} else {
$this->log('First parameter should be either "Created" or "Modified".','Warning');
return false;
}
} catch (Exception $e){
$this->log('Error: '.$e->getMessage(),'Warning');
return false;
}
} | php | public function setLimits($mode,$lower = null,$upper = null){
try{
if ($upper){
$before = $this->genTime($upper);
} else {
$before = $this->genTime('- 2 min');
}
if ($lower){
$after = $this->genTime($lower);
} else {
$after = $this->genTime('- 2 min');
}
if ($after > $before){
$after = $this->genTime($upper.' - 150 sec');
}
if ($mode == 'Created'){
$this->options['CreatedAfter'] = $after;
if ($before) {
$this->options['CreatedBefore'] = $before;
}
unset($this->options['LastUpdatedAfter']);
unset($this->options['LastUpdatedBefore']);
} else if ($mode == 'Modified'){
$this->options['LastUpdatedAfter'] = $after;
if ($before){
$this->options['LastUpdatedBefore'] = $before;
}
unset($this->options['CreatedAfter']);
unset($this->options['CreatedBefore']);
} else {
$this->log('First parameter should be either "Created" or "Modified".','Warning');
return false;
}
} catch (Exception $e){
$this->log('Error: '.$e->getMessage(),'Warning');
return false;
}
} | [
"public",
"function",
"setLimits",
"(",
"$",
"mode",
",",
"$",
"lower",
"=",
"null",
",",
"$",
"upper",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"upper",
")",
"{",
"$",
"before",
"=",
"$",
"this",
"->",
"genTime",
"(",
"$",
"upper",
"... | Sets the time frame for the orders fetched. (Optional)
Sets the time frame for the orders fetched. If no times are specified, times default to the current time.
@param string $mode <p>"Created" or "Modified"</p>
@param string $lower [optional] <p>A time string for the earliest time.</p>
@param string $upper [optional] <p>A time string for the latest time.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"time",
"frame",
"for",
"the",
"orders",
"fetched",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonOrderList.php#L96-L135 |
CPIGroup/phpAmazonMWS | includes/classes/AmazonOrderList.php | AmazonOrderList.setOrderStatusFilter | public function setOrderStatusFilter($list){
if (is_string($list)){
//if single string, set as filter
$this->resetOrderStatusFilter();
$this->options['OrderStatus.Status.1'] = $list;
} else if (is_array($list)){
//if array of strings, set all filters
$this->resetOrderStatusFilter();
$i = 1;
foreach($list as $x){
$this->options['OrderStatus.Status.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | php | public function setOrderStatusFilter($list){
if (is_string($list)){
//if single string, set as filter
$this->resetOrderStatusFilter();
$this->options['OrderStatus.Status.1'] = $list;
} else if (is_array($list)){
//if array of strings, set all filters
$this->resetOrderStatusFilter();
$i = 1;
foreach($list as $x){
$this->options['OrderStatus.Status.'.$i] = $x;
$i++;
}
} else {
return false;
}
} | [
"public",
"function",
"setOrderStatusFilter",
"(",
"$",
"list",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"list",
")",
")",
"{",
"//if single string, set as filter",
"$",
"this",
"->",
"resetOrderStatusFilter",
"(",
")",
";",
"$",
"this",
"->",
"options",
... | Sets the order status(es). (Optional)
This method sets the list of Order Statuses to be sent in the next request.
Setting this parameter tells Amazon to only return Orders with statuses that match
those in the list. If this parameter is not set, Amazon will return
Orders of any status.
@param array|string $list <p>A list of Order Statuses, or a single status string.</p>
@return boolean <b>FALSE</b> if improper input | [
"Sets",
"the",
"order",
"status",
"(",
"es",
")",
".",
"(",
"Optional",
")"
] | train | https://github.com/CPIGroup/phpAmazonMWS/blob/bf594dcb60e3176ec69148e90bd9e618f41a85d3/includes/classes/AmazonOrderList.php#L147-L163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.