|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Messages; |
|
4
|
|
|
|
|
5
|
|
|
use GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Parts\FaultCode; |
|
6
|
|
|
use GoetasWebservices\SoapServices\Metadata\Exception\Fault12Exception; |
|
|
|
|
|
|
7
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\ClientException; |
|
|
|
|
|
|
8
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\FaultException; |
|
|
|
|
|
|
9
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\MustUnderstandException; |
|
|
|
|
|
|
10
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\ServerException; |
|
|
|
|
|
|
11
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\SoapServerException; |
|
|
|
|
|
|
12
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\VersionMismatchException; |
|
|
|
|
|
|
13
|
|
|
use Psr\Http\Message\RequestInterface; |
|
14
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class representing Body |
|
18
|
|
|
*/ |
|
19
|
|
|
class Fault |
|
20
|
|
|
{ |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Messages\FaultBody $body |
|
24
|
|
|
*/ |
|
25
|
|
|
private $body = null; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Gets as body |
|
29
|
|
|
* |
|
30
|
|
|
* @return \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Messages\FaultBody |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getBody() |
|
33
|
|
|
{ |
|
34
|
|
|
return $this->body; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Sets a new body |
|
39
|
|
|
* |
|
40
|
|
|
* @param \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Messages\FaultBody $body |
|
41
|
|
|
* @return self |
|
42
|
|
|
*/ |
|
43
|
|
|
public function setBody(\GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Messages\FaultBody $body) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->body = $body; |
|
46
|
|
|
return $this; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public static function fromException(\Throwable $e, bool $debug = false): self |
|
50
|
|
|
{ |
|
51
|
|
|
$faultEnvelope = new self(); |
|
52
|
|
|
$faultBody = new FaultBody(); |
|
53
|
|
|
$faultEnvelope->setBody($faultBody); |
|
54
|
|
|
|
|
55
|
|
|
$fault = new \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope12\Parts\Fault(); |
|
56
|
|
|
if (!$e instanceof FaultException) { |
|
57
|
|
|
$e = new ServerException($e->getMessage(), $e->getCode(), $e); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
$faultCode = new FaultCode(); |
|
61
|
|
|
|
|
62
|
|
|
if ($e instanceof VersionMismatchException) { |
|
63
|
|
|
$faultCode->setValue('SOAP:VersionMismatch'); |
|
64
|
|
|
}elseif ($e instanceof MustUnderstandException) { |
|
65
|
|
|
$faultCode->setValue('SOAP:MustUnderstand'); |
|
66
|
|
|
}elseif ($e instanceof ClientException) { |
|
67
|
|
|
$faultCode->setValue('SOAP:Sender'); |
|
68
|
|
|
} else { |
|
69
|
|
|
$faultCode->setValue('SOAP:Receiver'); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
if ($e->getCode() !== 0) { |
|
73
|
|
|
$subFaultCode = new FaultCode(); |
|
74
|
|
|
$subFaultCode->setValue($e->getCode()); |
|
75
|
|
|
|
|
76
|
|
|
$faultCode->setSubcode($subFaultCode); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
$fault->setCode($faultCode); |
|
80
|
|
|
if ($debug) { |
|
81
|
|
|
$fault->setReason(array_merge([$e->getMessage()], explode("\n", (string)$e))); |
|
82
|
|
|
} else { |
|
83
|
|
|
$fault->setReason(explode("\n", $e->getMessage())); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
// @todo implement detail wrapping |
|
87
|
|
|
$fault->setDetail($e->getDetail()); |
|
|
|
|
|
|
88
|
|
|
|
|
89
|
|
|
|
|
90
|
|
|
$faultBody->setFault($fault); |
|
91
|
|
|
return $faultEnvelope; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @param ResponseInterface $response |
|
96
|
|
|
* @param RequestInterface $request |
|
97
|
|
|
* @param \Exception $e |
|
98
|
|
|
* @return \GoetasWebservices\SoapServices\Metadata\Exception\FaultException |
|
|
|
|
|
|
99
|
|
|
*/ |
|
100
|
|
|
public function createException(ResponseInterface $response, RequestInterface $request, \Exception $e = null) |
|
101
|
|
|
{ |
|
102
|
|
|
return new Fault12Exception($this->getBody()->getFault(), $response, $request, $e); |
|
103
|
|
|
} |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths