aboutsummaryrefslogtreecommitdiffstats
path: root/gsxlib.php
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@230.to>2013-07-12 12:09:50 +0300
committerFilipp Lepalaan <f@230.to>2013-07-12 12:09:50 +0300
commit5747faa7861502641ae86415c7c5af35bb92209c (patch)
tree2883777bbc5738e7c0d9a3a6f5fec411ae4ae358 /gsxlib.php
parent0769422c15da1df36951fbdab5338ef6d0ab3f55 (diff)
downloadgsxlib-5747faa7861502641ae86415c7c5af35bb92209c.tar.gz
gsxlib-5747faa7861502641ae86415c7c5af35bb92209c.tar.bz2
gsxlib-5747faa7861502641ae86415c7c5af35bb92209c.zip
Allow array as argument to repairDetails()
Diffstat (limited to 'gsxlib.php')
-rw-r--r--gsxlib.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/gsxlib.php b/gsxlib.php
index f405fed..dfea4e3 100644
--- a/gsxlib.php
+++ b/gsxlib.php
@@ -375,13 +375,16 @@ class GsxLib
*/
public function repairDetails($dispatchId)
{
- $dispatchId = trim($dispatchId);
-
- if( !self::looksLike( $dispatchId, 'dispatchId' )) {
- exit( 'Invalid dispatch ID: ' . $dispatchId );
+ if (is_string($dispatchId)) {
+ $dispatchId = trim($dispatchId);
+ if( !self::looksLike( $dispatchId, 'dispatchId' )) {
+ $error = sprintf('Invalid dispatch ID: %s', $dispatchId);
+ throw new InvalidArgumentException($error);
+ }
+ $dispatchId = array('dispatchId' => $dispatchId);
}
- $req = array('RepairDetails' => array('dispatchId' => $dispatchId));
+ $req = array('RepairDetails' => $dispatchId);
return $this->request($req)->lookupResponseData;
}