for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <[email protected]>
* Dariusz Rumiński <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Etrias\PaazlConnector\Processor;
use Etrias\PaazlConnector\ExceptionMap;
use Etrias\PaazlConnector\Exceptions\PaazlException;
use Etrias\PaazlConnector\SoapClient;
use WsdlToPhp\PackageBase\AbstractStructBase;
trait Processor
{
/**
* @param $response
* @param SoapClient $soapClient
* @throws PaazlException
* @return mixed
public function processResponse($response, SoapClient $soapClient)
if ($response === false) {
$errors = $soapClient->getLastError();
throw end($errors);
}
if ($response->getError()) {
$exceptionName = ExceptionMap::getException($response->getError()->getCode());
throw new $exceptionName();
if (!($response instanceof AbstractStructBase)) {
throw new PaazlException('Response is not a AbstructStructBase class');
return $response;