Skip to content

Commit 1c79356

Browse files
Added param to skip the quick availability check
1 parent 3d3f5e1 commit 1c79356

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

Mplusqapiclient.php

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ class MplusQAPIclient
6161
* @var
6262
*/
6363
private $skipFingerprintCheck = false;
64+
/**
65+
* @var
66+
*/
67+
private $skipQuickAvailabilityCheck = false;
6468
/**
6569
* @var
6670
*/
@@ -132,6 +136,9 @@ public function __construct($params=null)
132136
if (isset($params['skipApiVersionCheck'])) {
133137
$this->skipApiVersionCheck((bool)$params['skipApiVersionCheck']);
134138
}
139+
if (isset($params['skipQuickAvailabilityCheck'])) {
140+
$this->skipQuickAvailabilityCheck((bool)$params['skipQuickAvailabilityCheck']);
141+
}
135142
if (isset($params['apiServer']) and isset($params['apiPort']) and isset($params['apiIdent']) and isset($params['apiSecret'])) {
136143
$this->initClient();
137144
}
@@ -243,6 +250,21 @@ public function getSkipApiVersionCheck()
243250

244251
//----------------------------------------------------------------------------
245252

253+
/**
254+
* @param $skipQuickAvailabilityCheck
255+
*/
256+
public function skipQuickAvailabilityCheck($skipQuickAvailabilityCheck)
257+
{
258+
$this->skipQuickAvailabilityCheck = $skipQuickAvailabilityCheck;
259+
} // END skipQuickAvailabilityCheck()
260+
261+
public function getSkipQuickAvailabilityCheck()
262+
{
263+
return $this->skipQuickAvailabilityCheck;
264+
} // END getskipQuickAvailabilityCheck()
265+
266+
//----------------------------------------------------------------------------
267+
246268
/**
247269
* @param $skipFingerprintCheck
248270
*/
@@ -375,12 +397,14 @@ public function initClient()
375397

376398
$wsdl_url = $location.'?wsdl';
377399
try {
378-
// Don't wait longer than 5 seconds for the headers.
379-
// We call get_headers() here because we want a relatively fast check if the API is available at all
380-
// , before we actually initialize the SoapClient and start running requests
381-
ini_set('default_socket_timeout', 5);
382-
if (false === @get_headers($wsdl_url)) {
383-
throw new MplusQAPIException(sprintf('Cannot find API WSDL @ %s', $wsdl_url));
400+
if (!$this->skipQuickAvailabilityCheck) {
401+
// Don't wait longer than 5 seconds for the headers.
402+
// We call get_headers() here because we want a relatively fast check if the API is available at all
403+
// , before we actually initialize the SoapClient and start running requests
404+
ini_set('default_socket_timeout', 5);
405+
if (false === @get_headers($wsdl_url)) {
406+
throw new MplusQAPIException(sprintf('Cannot find API WSDL @ %s', $wsdl_url));
407+
}
384408
}
385409
$this->client = @new SoapClient($wsdl_url, $options);
386410
if (false === $this->client or is_null($this->client)) {

0 commit comments

Comments
 (0)