Skip to content

Commit

Permalink
Merge branch 'feature/issue-219' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelcom committed Nov 6, 2020
1 parent 8d6fec7 commit 825ed27
Show file tree
Hide file tree
Showing 20 changed files with 817 additions and 569 deletions.
2 changes: 1 addition & 1 deletion src/File/AbstractOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractOperation
/**
* @var string
*/
const SOAP_CALL_NAME = '__call';
const SOAP_CALL_NAME = '__soapCall';
/**
* @var MethodModel
*/
Expand Down
25 changes: 5 additions & 20 deletions src/File/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ protected function defineBody(PhpMethod $method)
*/
protected function getSoapCallName()
{
$soapCall = sprintf('%s(', $this->getMethod()->getName());
if ($this->getMethod()->nameIsClean() === false) {
$soapCall = sprintf('%s(\'%s\'%s', self::SOAP_CALL_NAME, $this->getMethod()->getName(), $this->getOperationCallParametersStarting());
}
return $soapCall;
return sprintf('%s(\'%s\'%s', self::SOAP_CALL_NAME, $this->getMethod()->getName(), $this->getOperationCallParametersStarting());
}
/**
* @param PhpMethod $method
Expand All @@ -105,28 +101,21 @@ protected function getOperationCallParameters(PhpMethod $method)
$parameters[] = $this->getOperationCallParameterName($parameter, $method);
}
}
return sprintf('%s%s', implode($this->getOperationCallParametersSeparator(), $parameters), $this->getOperationCallParametersEnding());
}
/**
* @return string
*/
protected function getOperationCallParametersSeparator()
{
return $this->getMethod()->nameIsClean() === false ? '' : ', ';
return sprintf('%s%s, array(), array(), $this->outputHeaders', implode('', $parameters), $this->isParameterTypeEmpty() ? '' : PhpMethod::BREAK_LINE_CHAR . ')');
}
/**
* @return string
*/
protected function getOperationCallParametersStarting()
{
return ($this->isParameterTypeAnArray() && $this->getMethod()->nameIsClean() === false) ? ', array(' : ($this->isParameterTypeEmpty() ? '' : ', ');
return $this->isParameterTypeAnArray() ? ', array(' : ($this->isParameterTypeEmpty() ? ', array()' : ', array(');
}
/**
* @return string
*/
protected function getOperationCallParametersEnding()
{
return ($this->isParameterTypeAnArray() && $this->getMethod()->nameIsClean() === false) ? sprintf('%s)', PhpMethod::BREAK_LINE_CHAR) : '';
return sprintf('%s)', PhpMethod::BREAK_LINE_CHAR);
}
/**
* @param PhpFunctionParameter $parameter
Expand All @@ -137,10 +126,6 @@ protected function getOperationCallParameterName(PhpFunctionParameter $parameter
{
$cloneParameter = clone $parameter;
$cloneParameter->setType(null);
if ($this->getMethod()->nameIsClean() === false) {
return sprintf('%s%s', PhpMethod::BREAK_LINE_CHAR, $method->getIndentedString(sprintf('%s,', $cloneParameter->getPhpDeclaration()), 1));
} else {
return $cloneParameter->getPhpDeclaration();
}
return sprintf('%s%s', PhpMethod::BREAK_LINE_CHAR, $method->getIndentedString(sprintf('%s,', $cloneParameter->getPhpDeclaration()), 1));
}
}
2 changes: 1 addition & 1 deletion tests/File/AbstractFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function assertSameFileContent($valid, File $file, $fileExtension = 'p
return $this->fail(sprintf('Generated file "%s" could not be found', $file->getFileName()));
}
// uncomment next line to easily regenerate all valid files :)
//file_put_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension), str_replace($file->getGenerator()->getWsdl()->getName(), '__WSDL_URL__', file_get_contents($file->getFileName())));
file_put_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension), str_replace($file->getGenerator()->getWsdl()->getName(), '__WSDL_URL__', file_get_contents($file->getFileName())));
$validContent = file_get_contents(sprintf('%s%s.%s', self::getTestDirectory(), $valid, $fileExtension));
$validContent = str_replace('__WSDL_URL__', $file->getGenerator()->getWsdl()->getName(), $validContent);
$toBeValidatedContent = file_get_contents($file->getFileName());
Expand Down
32 changes: 24 additions & 8 deletions tests/resources/generated/ValidActonApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public function setSoapHeaderSessionHeader(\Api\StructType\ApiSessionHeader $ses
public function login(\Api\StructType\ApiLogin $parameter)
{
try {
$this->setResult($this->getSoapClient()->login($parameter));
$this->setResult($this->getSoapClient()->__soapCall('login', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -81,7 +83,9 @@ public function login(\Api\StructType\ApiLogin $parameter)
public function sendEmail(\Api\StructType\ApiSendEmail $parameter)
{
try {
$this->setResult($this->getSoapClient()->sendEmail($parameter));
$this->setResult($this->getSoapClient()->__soapCall('sendEmail', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -106,7 +110,9 @@ public function sendEmail(\Api\StructType\ApiSendEmail $parameter)
public function _list(\Api\StructType\ApiList $parameter)
{
try {
$this->setResult($this->getSoapClient()->list($parameter));
$this->setResult($this->getSoapClient()->__soapCall('list', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -131,7 +137,9 @@ public function _list(\Api\StructType\ApiList $parameter)
public function uploadList(\Api\StructType\ApiUploadList $parameter)
{
try {
$this->setResult($this->getSoapClient()->uploadList($parameter));
$this->setResult($this->getSoapClient()->__soapCall('uploadList', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -156,7 +164,9 @@ public function uploadList(\Api\StructType\ApiUploadList $parameter)
public function getUploadResult(\Api\StructType\ApiGetUploadResultRequest $parameter)
{
try {
$this->setResult($this->getSoapClient()->getUploadResult($parameter));
$this->setResult($this->getSoapClient()->__soapCall('getUploadResult', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -181,7 +191,9 @@ public function getUploadResult(\Api\StructType\ApiGetUploadResultRequest $param
public function downloadList(\Api\StructType\ApiDownloadList $parameter)
{
try {
$this->setResult($this->getSoapClient()->downloadList($parameter));
$this->setResult($this->getSoapClient()->__soapCall('downloadList', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -205,7 +217,9 @@ public function downloadList(\Api\StructType\ApiDownloadList $parameter)
public function messageReport(\Api\StructType\ApiMessageReport $parameter)
{
try {
$this->setResult($this->getSoapClient()->messageReport($parameter));
$this->setResult($this->getSoapClient()->__soapCall('messageReport', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -229,7 +243,9 @@ public function messageReport(\Api\StructType\ApiMessageReport $parameter)
public function deleteList(\Api\StructType\ApiDeleteList $parameter)
{
try {
$this->setResult($this->getSoapClient()->deleteList($parameter));
$this->setResult($this->getSoapClient()->__soapCall('deleteList', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand Down
16 changes: 12 additions & 4 deletions tests/resources/generated/ValidApiAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class ApiAuthenticate extends AbstractSoapClientBase
public function AuthenticateAccount($authenticateAccount)
{
try {
$this->setResult($this->getSoapClient()->AuthenticateAccount($authenticateAccount));
$this->setResult($this->getSoapClient()->__soapCall('AuthenticateAccount', array(
$authenticateAccount,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -43,7 +45,9 @@ public function AuthenticateAccount($authenticateAccount)
public function AuthenticateAdmin($authenticateAdmin)
{
try {
$this->setResult($this->getSoapClient()->AuthenticateAdmin($authenticateAdmin));
$this->setResult($this->getSoapClient()->__soapCall('AuthenticateAdmin', array(
$authenticateAdmin,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -62,7 +66,9 @@ public function AuthenticateAdmin($authenticateAdmin)
public function AuthenticateReseller($authenticateReseller)
{
try {
$this->setResult($this->getSoapClient()->AuthenticateReseller($authenticateReseller));
$this->setResult($this->getSoapClient()->__soapCall('AuthenticateReseller', array(
$authenticateReseller,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -81,7 +87,9 @@ public function AuthenticateReseller($authenticateReseller)
public function AuthenticateCustomer($authenticateCustomer)
{
try {
$this->setResult($this->getSoapClient()->AuthenticateCustomer($authenticateCustomer));
$this->setResult($this->getSoapClient()->__soapCall('AuthenticateCustomer', array(
$authenticateCustomer,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand Down
4 changes: 3 additions & 1 deletion tests/resources/generated/ValidApiCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class ApiCreate extends AbstractSoapClientBase
public function CreateQueue(\Api\StructType\ApiCreateQueue $body)
{
try {
$this->setResult($this->getSoapClient()->CreateQueue($body));
$this->setResult($this->getSoapClient()->__soapCall('CreateQueue', array(
$body,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand Down
4 changes: 3 additions & 1 deletion tests/resources/generated/ValidApiDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ public function setSoapHeaderClusterHeader(\Api\StructType\ApiClusterHeader $clu
public function deleteList(\Api\StructType\ApiDeleteList $parameter)
{
try {
$this->setResult($this->getSoapClient()->deleteList($parameter));
$this->setResult($this->getSoapClient()->__soapCall('deleteList', array(
$parameter,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand Down
48 changes: 36 additions & 12 deletions tests/resources/generated/ValidApiDo.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public function setSoapHeaderRequesterCredentials(\Api\StructType\ApiCustomSecur
public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPaymentReq $doMobileCheckoutPaymentRequest)
{
try {
$this->setResult($this->getSoapClient()->DoMobileCheckoutPayment($doMobileCheckoutPaymentRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoMobileCheckoutPayment', array(
$doMobileCheckoutPaymentRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -66,7 +68,9 @@ public function DoMobileCheckoutPayment(\Api\StructType\ApiDoMobileCheckoutPayme
public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPaymentReq $doExpressCheckoutPaymentRequest)
{
try {
$this->setResult($this->getSoapClient()->DoExpressCheckoutPayment($doExpressCheckoutPaymentRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoExpressCheckoutPayment', array(
$doExpressCheckoutPaymentRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -90,7 +94,9 @@ public function DoExpressCheckoutPayment(\Api\StructType\ApiDoExpressCheckoutPay
public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressCheckoutPaymentReq $doUATPExpressCheckoutPaymentRequest)
{
try {
$this->setResult($this->getSoapClient()->DoUATPExpressCheckoutPayment($doUATPExpressCheckoutPaymentRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoUATPExpressCheckoutPayment', array(
$doUATPExpressCheckoutPaymentRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -114,7 +120,9 @@ public function DoUATPExpressCheckoutPayment(\Api\StructType\ApiDoUATPExpressChe
public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectPaymentRequest)
{
try {
$this->setResult($this->getSoapClient()->DoDirectPayment($doDirectPaymentRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoDirectPayment', array(
$doDirectPaymentRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -138,7 +146,9 @@ public function DoDirectPayment(\Api\StructType\ApiDoDirectPaymentReq $doDirectP
public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest)
{
try {
$this->setResult($this->getSoapClient()->DoCancel($doCancelRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoCancel', array(
$doCancelRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -162,7 +172,9 @@ public function DoCancel(\Api\StructType\ApiDoCancelReq $doCancelRequest)
public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest)
{
try {
$this->setResult($this->getSoapClient()->DoCapture($doCaptureRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoCapture', array(
$doCaptureRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -186,7 +198,9 @@ public function DoCapture(\Api\StructType\ApiDoCaptureReq $doCaptureRequest)
public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doReauthorizationRequest)
{
try {
$this->setResult($this->getSoapClient()->DoReauthorization($doReauthorizationRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoReauthorization', array(
$doReauthorizationRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -210,7 +224,9 @@ public function DoReauthorization(\Api\StructType\ApiDoReauthorizationReq $doRea
public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest)
{
try {
$this->setResult($this->getSoapClient()->DoVoid($doVoidRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoVoid', array(
$doVoidRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -234,7 +250,9 @@ public function DoVoid(\Api\StructType\ApiDoVoidReq $doVoidRequest)
public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthorizationRequest)
{
try {
$this->setResult($this->getSoapClient()->DoAuthorization($doAuthorizationRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoAuthorization', array(
$doAuthorizationRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -258,7 +276,9 @@ public function DoAuthorization(\Api\StructType\ApiDoAuthorizationReq $doAuthori
public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $doUATPAuthorizationRequest)
{
try {
$this->setResult($this->getSoapClient()->DoUATPAuthorization($doUATPAuthorizationRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoUATPAuthorization', array(
$doUATPAuthorizationRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -282,7 +302,9 @@ public function DoUATPAuthorization(\Api\StructType\ApiDoUATPAuthorizationReq $d
public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransactionReq $doReferenceTransactionRequest)
{
try {
$this->setResult($this->getSoapClient()->DoReferenceTransaction($doReferenceTransactionRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoReferenceTransaction', array(
$doReferenceTransactionRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand All @@ -306,7 +328,9 @@ public function DoReferenceTransaction(\Api\StructType\ApiDoReferenceTransaction
public function DoNonReferencedCredit(\Api\StructType\ApiDoNonReferencedCreditReq $doNonReferencedCreditRequest)
{
try {
$this->setResult($this->getSoapClient()->DoNonReferencedCredit($doNonReferencedCreditRequest));
$this->setResult($this->getSoapClient()->__soapCall('DoNonReferencedCredit', array(
$doNonReferencedCreditRequest,
), array(), array(), $this->outputHeaders));
return $this->getResult();
} catch (\SoapFault $soapFault) {
$this->saveLastError(__METHOD__, $soapFault);
Expand Down
Loading

0 comments on commit 825ed27

Please sign in to comment.