So I'm thinking I could do something along these lines, once I figure out what "magic" to do:
class SyncSoap extends SoapClient
{
private $debug;
/**
* Constructor
* @return void
* @throws SoapFault if cannot load the WSDL
*/
public function __construct($debug=false)
{
$this->debug = (bool) $debug;
$wsdl = realpath(dirname(__FILE__)).'/none_of_your_business.wsdl';
if(!file_exists($wsdl) or !is_readable($wsdl)) {
$wsdl = 'http://top.secret.domain.com/none_of_your_business.wsdl';
}
parent::SoapClient($this->wsdl);
}
/**
* Override so we can test without a server
*/
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
if($this->debug) {
// DEBUG MAGIC HAPPENS HERE
}
else {
return parent::__doRequest($request, $location, $action, $version, $one_way = 0);
}
}
}