|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Messages; |
|
4
|
|
|
|
|
5
|
|
|
use GoetasWebservices\SoapServices\Metadata\Exception\Fault11Exception; |
|
|
|
|
|
|
6
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\ClientException; |
|
|
|
|
|
|
7
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\FaultException; |
|
|
|
|
|
|
8
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\MustUnderstandException; |
|
|
|
|
|
|
9
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\ServerException; |
|
|
|
|
|
|
10
|
|
|
use GoetasWebservices\SoapServices\SoapServer\Exception\VersionMismatchException; |
|
|
|
|
|
|
11
|
|
|
use Psr\Http\Message\RequestInterface; |
|
12
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class representing Body |
|
16
|
|
|
*/ |
|
17
|
|
|
class Fault |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @var \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Messages\FaultBody $body |
|
22
|
|
|
*/ |
|
23
|
|
|
private $body = null; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Gets as body |
|
27
|
|
|
* |
|
28
|
|
|
* @return \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Messages\FaultBody |
|
29
|
|
|
*/ |
|
30
|
|
|
public function getBody() |
|
31
|
|
|
{ |
|
32
|
|
|
return $this->body; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Sets a new body |
|
37
|
|
|
* |
|
38
|
|
|
* @param \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Messages\FaultBody $body |
|
39
|
|
|
* @return self |
|
40
|
|
|
*/ |
|
41
|
|
|
public function setBody(\GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Messages\FaultBody $body) |
|
42
|
|
|
{ |
|
43
|
|
|
$this->body = $body; |
|
44
|
|
|
return $this; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public static function fromException(\Throwable $e, bool $debug = false): self |
|
48
|
|
|
{ |
|
49
|
|
|
$faultEnvelope = new self(); |
|
50
|
|
|
$faultBody = new FaultBody(); |
|
51
|
|
|
$faultEnvelope->setBody($faultBody); |
|
52
|
|
|
|
|
53
|
|
|
$fault = new \GoetasWebservices\SoapServices\Metadata\Envelope\SoapEnvelope\Parts\Fault(); |
|
54
|
|
|
if (!$e instanceof FaultException) { |
|
55
|
|
|
$e = new ServerException($e->getMessage(), $e->getCode(), $e); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
if ($e instanceof ClientException) { |
|
59
|
|
|
$fault->setCode('SOAP:Client'); |
|
60
|
|
|
}elseif ($e instanceof VersionMismatchException) { |
|
61
|
|
|
$fault->setCode('SOAP:VersionMismatch'); |
|
62
|
|
|
}elseif ($e instanceof MustUnderstandException) { |
|
63
|
|
|
$fault->setCode('SOAP:MustUnderstand'); |
|
64
|
|
|
} else { |
|
65
|
|
|
$fault->setCode('SOAP:Server'); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
if ($debug) { |
|
69
|
|
|
$fault->setString(implode("\n", array_merge([$e->getMessage()], explode("\n", (string)$e)))); |
|
70
|
|
|
} else { |
|
71
|
|
|
$fault->setString($e->getMessage()); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
// @todo implement detail wrapping |
|
75
|
|
|
$fault->setDetail($e->getDetail()); |
|
|
|
|
|
|
76
|
|
|
|
|
77
|
|
|
$faultBody->setFault($fault); |
|
78
|
|
|
return $faultEnvelope; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param ResponseInterface $response |
|
83
|
|
|
* @param RequestInterface $request |
|
84
|
|
|
* @param \Exception $e |
|
85
|
|
|
* @return \GoetasWebservices\SoapServices\Metadata\Exception\Fault11Exception |
|
86
|
|
|
*/ |
|
87
|
|
|
public function createException(ResponseInterface $response, RequestInterface $request, \Exception $e = null) |
|
88
|
|
|
{ |
|
89
|
|
|
return new Fault11Exception($this->getBody()->getFault(), $response, $request, $e); |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
|
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