WsdlDownloader fix: remote includes now work correctly with relative URLs & tests added

This commit is contained in:
Petr Bechyně
2017-07-18 18:52:52 +02:00
parent b650254d54
commit 6970b7bbef
9 changed files with 583 additions and 194 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace BeSimple\SoapClient\Xml;
use Exception;
class RemoteFileResolver
{
public static function instantiateResolver()
{
return new self();
}
/**
* @param string $wsdlPath File URL/path
* @return boolean
*/
public function isRemoteFile($wsdlPath)
{
$parsedUrlOrFalse = @parse_url($wsdlPath);
if ($parsedUrlOrFalse !== false) {
if (isset($parsedUrlOrFalse['scheme']) && strpos($parsedUrlOrFalse['scheme'], 'http') === 0) {
return true;
}
return false;
}
throw new Exception('Could not determine wsdlPath is remote: '.$wsdlPath);
}
}