dmt-software /
jms-soap-serializer
| 1 | <?php |
||
| 2 | |||
| 3 | namespace DMT\Soap\Serializer; |
||
| 4 | |||
| 5 | use RuntimeException; |
||
| 6 | use SoapFault; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class SoapFaultException |
||
| 10 | * |
||
| 11 | * @package DMT\Soap |
||
| 12 | */ |
||
| 13 | class SoapFaultException extends RuntimeException |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | public $code; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | public $reason; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | public $node; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var array |
||
| 32 | */ |
||
| 33 | public $detail; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * SoapFaultException constructor. |
||
| 37 | * |
||
| 38 | * @param string $code |
||
| 39 | * @param string $reason |
||
| 40 | * @param string|null $node |
||
| 41 | * @param array|null $detail |
||
| 42 | */ |
||
| 43 | 7 | public function __construct(string $code, string $reason, string $node = null, array $detail = null) |
|
| 44 | { |
||
| 45 | 7 | $this->code = $code; |
|
| 46 | 7 | $this->reason = $reason; |
|
| 47 | 7 | $this->node = $node; |
|
| 48 | 7 | $this->detail = $detail; |
|
| 49 | |||
| 50 | 7 | $previous = null; |
|
| 51 | 7 | if (class_exists(SoapFault::class)) { |
|
| 52 | 7 | $code = preg_replace( |
|
| 53 | 7 | ['~^Receiver~', '~^Sender~', '~^DataEncodingUnknown~'], |
|
| 54 | 7 | ['Server', 'Client', 'Client'], |
|
| 55 | 7 | $this->code |
|
| 56 | ); |
||
| 57 | 7 | $previous = new SoapFault($code, $reason, $node, $detail); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 58 | } |
||
| 59 | |||
| 60 | 7 | parent::__construct($reason, 0, $previous); |
|
| 61 | 7 | } |
|
| 62 | |||
| 63 | 7 | public function getFaultCode(): string |
|
| 64 | { |
||
| 65 | 7 | return $this->code; |
|
| 66 | } |
||
| 67 | } |
||
| 68 |