| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
namespace Symfony\Component\Serializer\Context\Encoder; |
| 13 |
|
| 14 |
use Symfony\Component\Serializer\Context\ContextBuilderInterface; |
| 15 |
use Symfony\Component\Serializer\Context\ContextBuilderTrait; |
| 16 |
use Symfony\Component\Serializer\Encoder\XmlEncoder; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
final class XmlEncoderContextBuilder implements ContextBuilderInterface |
| 24 |
{ |
| 25 |
use ContextBuilderTrait; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public function withAsCollection(?bool $asCollection): static |
| 32 |
{ |
| 33 |
return $this->with(XmlEncoder::AS_COLLECTION, $asCollection); |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
public function withDecoderIgnoredNodeTypes(?array $decoderIgnoredNodeTypes): static |
| 44 |
{ |
| 45 |
return $this->with(XmlEncoder::DECODER_IGNORED_NODE_TYPES, $decoderIgnoredNodeTypes); |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public function withEncoderIgnoredNodeTypes(?array $encoderIgnoredNodeTypes): static |
| 56 |
{ |
| 57 |
return $this->with(XmlEncoder::ENCODER_IGNORED_NODE_TYPES, $encoderIgnoredNodeTypes); |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
public function withEncoding(?string $encoding): static |
| 66 |
{ |
| 67 |
return $this->with(XmlEncoder::ENCODING, $encoding); |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public function withFormatOutput(?bool $formatOutput): static |
| 76 |
{ |
| 77 |
return $this->with(XmlEncoder::FORMAT_OUTPUT, $formatOutput); |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
public function withLoadOptions(?int $loadOptions): static |
| 88 |
{ |
| 89 |
return $this->with(XmlEncoder::LOAD_OPTIONS, $loadOptions); |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public function withSaveOptions(?int $saveOptions): static |
| 100 |
{ |
| 101 |
return $this->with(XmlEncoder::SAVE_OPTIONS, $saveOptions); |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
public function withRemoveEmptyTags(?bool $removeEmptyTags): static |
| 108 |
{ |
| 109 |
return $this->with(XmlEncoder::REMOVE_EMPTY_TAGS, $removeEmptyTags); |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
public function withRootNodeName(?string $rootNodeName): static |
| 116 |
{ |
| 117 |
return $this->with(XmlEncoder::ROOT_NODE_NAME, $rootNodeName); |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
public function withStandalone(?bool $standalone): static |
| 126 |
{ |
| 127 |
return $this->with(XmlEncoder::STANDALONE, $standalone); |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
public function withTypeCastAttributes(?bool $typeCastAttributes): static |
| 134 |
{ |
| 135 |
return $this->with(XmlEncoder::TYPE_CAST_ATTRIBUTES, $typeCastAttributes); |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
public function withVersion(?string $version): static |
| 144 |
{ |
| 145 |
return $this->with(XmlEncoder::VERSION, $version); |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
public function withCdataWrapping(?bool $cdataWrapping): static |
| 152 |
{ |
| 153 |
return $this->with(XmlEncoder::CDATA_WRAPPING, $cdataWrapping); |
| 154 |
} |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
public function withCdataWrappingPattern(?string $cdataWrappingPattern): static |
| 160 |
{ |
| 161 |
return $this->with(XmlEncoder::CDATA_WRAPPING_PATTERN, $cdataWrappingPattern); |
| 162 |
} |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
public function withIgnoreEmptyAttributes(?bool $ignoreEmptyAttributes): static |
| 168 |
{ |
| 169 |
return $this->with(XmlEncoder::IGNORE_EMPTY_ATTRIBUTES, $ignoreEmptyAttributes); |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
public function withPreserveNumericKeys(?bool $preserveNumericKeys): static |
| 176 |
{ |
| 177 |
return $this->with(XmlEncoder::PRESERVE_NUMERIC_KEYS, $preserveNumericKeys); |
| 178 |
} |
| 179 |
} |