|
14 | 14 |
|
15 | 15 | #[Serializer\XmlRoot('cXML')] |
16 | 16 | #[Serializer\AccessorOrder(order: 'custom', custom: ['header', 'message', 'request', 'response'])] |
17 | | -readonly class CXml implements Stringable |
| 17 | +class CXml implements Stringable |
18 | 18 | { |
19 | 19 | final public const DEPLOYMENT_TEST = 'test'; |
20 | 20 |
|
|
23 | 23 | protected function __construct( |
24 | 24 | #[Serializer\XmlAttribute] |
25 | 25 | #[Serializer\SerializedName('payloadID')] |
26 | | - public string $payloadId, |
| 26 | + readonly public string $payloadId, |
27 | 27 | #[Serializer\XmlAttribute] |
28 | | - public DateTimeInterface $timestamp, |
| 28 | + readonly public DateTimeInterface $timestamp, |
29 | 29 | #[Serializer\SerializedName('Request')] |
30 | | - public ?Request $request = null, |
| 30 | + readonly public ?Request $request = null, |
31 | 31 | #[Serializer\SerializedName('Response')] |
32 | | - public ?Response $response = null, |
| 32 | + readonly public ?Response $response = null, |
33 | 33 | #[Serializer\SerializedName('Message')] |
34 | | - public ?Message $message = null, |
| 34 | + readonly public ?Message $message = null, |
35 | 35 | #[Serializer\SerializedName('Header')] |
36 | | - public ?Header $header = null, |
| 36 | + readonly public ?Header $header = null, |
37 | 37 | #[Serializer\XmlAttribute(namespace: 'http://www.w3.org/XML/1998/namespace')] |
38 | | - public ?string $lang = null, |
| 38 | + readonly public ?string $lang = null, |
| 39 | + #[Serializer\Exclude] |
| 40 | + public string $dtdUri = 'http://xml.cxml.org/schemas/cXML/1.2.063/cXML.dtd', |
39 | 41 | ) { |
40 | 42 | } |
41 | 43 |
|
42 | | - public static function forMessage(PayloadIdentity $payloadIdentity, Message $message, Header $header, ?string $lang = null): self |
| 44 | + public function setDtdUri(string $dtdUri): void |
43 | 45 | { |
44 | | - return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, null, null, $message, $header, $lang); |
| 46 | + $this->dtdUri = $dtdUri; |
45 | 47 | } |
46 | 48 |
|
47 | | - public static function forRequest(PayloadIdentity $payloadIdentity, Request $request, Header $header, ?string $lang = null): self |
| 49 | + public static function forMessage(PayloadIdentity $payloadIdentity, Message $message, Header $header, ?string $lang = null, string $dtdUri = 'http://xml.cxml.org/schemas/cXML/1.2.063/cXML.dtd'): self |
48 | 50 | { |
49 | | - return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, $request, null, null, $header, $lang); |
| 51 | + return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, null, null, $message, $header, $lang, $dtdUri); |
50 | 52 | } |
51 | 53 |
|
52 | | - public static function forResponse(PayloadIdentity $payloadIdentity, Response $response, ?string $lang = null): self |
| 54 | + public static function forRequest(PayloadIdentity $payloadIdentity, Request $request, Header $header, ?string $lang = null, string $dtdUri = 'http://xml.cxml.org/schemas/cXML/1.2.063/cXML.dtd'): self |
53 | 55 | { |
54 | | - return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, null, $response, null, null, $lang); |
| 56 | + return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, $request, null, null, $header, $lang, $dtdUri); |
| 57 | + } |
| 58 | + |
| 59 | + public static function forResponse(PayloadIdentity $payloadIdentity, Response $response, ?string $lang = null, string $dtdUri = 'http://xml.cxml.org/schemas/cXML/1.2.063/cXML.dtd'): self |
| 60 | + { |
| 61 | + return new self($payloadIdentity->payloadId, $payloadIdentity->timestamp, null, $response, null, null, $lang, $dtdUri); |
55 | 62 | } |
56 | 63 |
|
57 | 64 | public function __toString(): string |
|
0 commit comments