Skip to content

Commit

Permalink
fix: add getPath() method to retrieve wsdl file path
Browse files Browse the repository at this point in the history
  • Loading branch information
krzaczek committed Sep 22, 2023
1 parent 9bf79d2 commit 087d6ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ require_once __DIR__ . '/vendor/autoload.php';
/**
* Minimal options
*/
$reflector = new \ReflectionClass(\PocztaPolska\EnumType\WsdlType::class);
$options = [
WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => realpath(dirname($reflector->getFileName()) . '/' . \PocztaPolska\EnumType\WsdlType::WSDL_FILE);
WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => \PocztaPolska\EnumType\WsdlType::getPath(),
WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \PocztaPolska\ClassMap::get(),
WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOGIN = "login",
WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_PASSWORD = "secret",
Expand Down
9 changes: 9 additions & 0 deletions src/PocztaPolska/EnumType/WsdlType.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ class WsdlType
{
public const WSDL_FILE = '../../../wsdl/en.wsdl';
public const WSDL_TEST_FILE = '../../../wsdl/test/en.wsdl';

public static function getPath(bool $sandbox = false): string
{
if ($sandbox) {
return realpath(__DIR__ . '/' . self::WSDL_TEST_FILE);
}

return realpath(__DIR__ . '/' . self::WSDL_FILE);
}
}

0 comments on commit 087d6ba

Please sign in to comment.