From 5747faa7861502641ae86415c7c5af35bb92209c Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 12 Jul 2013 12:09:50 +0300 Subject: Allow array as argument to repairDetails() --- gsxlib.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gsxlib.php') 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; } -- cgit v1.2.3