vasildakov /
speedy
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace VasilDakov\Speedy\Service\Shipment; |
||
| 6 | |||
| 7 | use JMS\Serializer\Annotation as Serializer; |
||
| 8 | use VasilDakov\Speedy\Traits\ToArray; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Class CreateShipmentRequest. |
||
| 12 | * |
||
| 13 | * @author Valentin Valkanov <[email protected]> |
||
| 14 | * @author Vasil Dakov <[email protected]> |
||
| 15 | * @copyright 2009-2023 Neutrino.bg |
||
| 16 | * |
||
| 17 | * @version 1.0 |
||
| 18 | * |
||
| 19 | * @Serializer\AccessType("public_method") |
||
| 20 | */ |
||
| 21 | class CreateShipmentRequest |
||
| 22 | { |
||
| 23 | use ToArray; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 24 | |||
| 25 | /** |
||
| 26 | * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentSender") |
||
| 27 | */ |
||
| 28 | private ShipmentSender $sender; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentRecipient") |
||
| 32 | */ |
||
| 33 | private ShipmentRecipient $recipient; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentService") |
||
| 37 | */ |
||
| 38 | private ShipmentService $service; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentContent") |
||
| 42 | */ |
||
| 43 | private ShipmentContent $content; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @Serializer\Type("VasilDakov\Speedy\Service\Shipment\ShipmentPayment") |
||
| 47 | */ |
||
| 48 | private ShipmentPayment $payment; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @Serializer\Type("string") |
||
| 52 | */ |
||
| 53 | private ?string $shipmentNote = null; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @Serializer\Type("string") |
||
| 57 | */ |
||
| 58 | private ?string $ref1 = null; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @Serializer\Type("string") |
||
| 62 | */ |
||
| 63 | private ?string $ref2 = null; |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @Serializer\Type("string") |
||
| 67 | */ |
||
| 68 | private ?string $consolidationRef = null; |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @Serializer\Type("bool") |
||
| 72 | */ |
||
| 73 | private bool $requireUnsuccessfulDeliveryStickerImage = false; |
||
| 74 | |||
| 75 | 12 | public function __construct( |
|
| 76 | ShipmentSender $sender, |
||
| 77 | ShipmentRecipient $recipient, |
||
| 78 | ShipmentService $service, |
||
| 79 | ShipmentContent $content, |
||
| 80 | ShipmentPayment $payment, |
||
| 81 | string $ref1 |
||
| 82 | ) { |
||
| 83 | 12 | $this->sender = $sender; |
|
| 84 | 12 | $this->recipient = $recipient; |
|
| 85 | 12 | $this->service = $service; |
|
| 86 | 12 | $this->content = $content; |
|
| 87 | 12 | $this->payment = $payment; |
|
| 88 | 12 | $this->ref1 = $ref1; |
|
| 89 | } |
||
| 90 | |||
| 91 | 2 | public function getRecipient(): ShipmentRecipient |
|
| 92 | { |
||
| 93 | 2 | return $this->recipient; |
|
| 94 | } |
||
| 95 | |||
| 96 | 2 | public function setRecipient(ShipmentRecipient $recipient): void |
|
| 97 | { |
||
| 98 | 2 | $this->recipient = $recipient; |
|
| 99 | } |
||
| 100 | |||
| 101 | 2 | public function getService(): ShipmentService |
|
| 102 | { |
||
| 103 | 2 | return $this->service; |
|
| 104 | } |
||
| 105 | |||
| 106 | 2 | public function setService(ShipmentService $service): void |
|
| 107 | { |
||
| 108 | 2 | $this->service = $service; |
|
| 109 | } |
||
| 110 | |||
| 111 | 2 | public function getContent(): ShipmentContent |
|
| 112 | { |
||
| 113 | 2 | return $this->content; |
|
| 114 | } |
||
| 115 | |||
| 116 | 2 | public function setContent(ShipmentContent $content): void |
|
| 117 | { |
||
| 118 | 2 | $this->content = $content; |
|
| 119 | } |
||
| 120 | |||
| 121 | 2 | public function getPayment(): ShipmentPayment |
|
| 122 | { |
||
| 123 | 2 | return $this->payment; |
|
| 124 | } |
||
| 125 | |||
| 126 | 2 | public function setPayment(ShipmentPayment $payment): void |
|
| 127 | { |
||
| 128 | 2 | $this->payment = $payment; |
|
| 129 | } |
||
| 130 | |||
| 131 | 1 | public function getSender(): ShipmentSender |
|
| 132 | { |
||
| 133 | 1 | return $this->sender; |
|
| 134 | } |
||
| 135 | |||
| 136 | 3 | public function setSender(ShipmentSender $sender): void |
|
| 137 | { |
||
| 138 | 3 | $this->sender = $sender; |
|
| 139 | } |
||
| 140 | |||
| 141 | 1 | public function getShipmentNote(): ?string |
|
| 142 | { |
||
| 143 | 1 | return $this->shipmentNote; |
|
| 144 | } |
||
| 145 | |||
| 146 | 3 | public function setShipmentNote(string $shipmentNote): void |
|
| 147 | { |
||
| 148 | 3 | $this->shipmentNote = $shipmentNote; |
|
| 149 | } |
||
| 150 | |||
| 151 | 1 | public function getRef1(): ?string |
|
| 152 | { |
||
| 153 | 1 | return $this->ref1; |
|
| 154 | } |
||
| 155 | |||
| 156 | 3 | public function setRef1(string $ref1): void |
|
| 157 | { |
||
| 158 | 3 | $this->ref1 = $ref1; |
|
| 159 | } |
||
| 160 | |||
| 161 | 1 | public function getRef2(): ?string |
|
| 162 | { |
||
| 163 | 1 | return $this->ref2; |
|
| 164 | } |
||
| 165 | |||
| 166 | 3 | public function setRef2(string $ref2): void |
|
| 167 | { |
||
| 168 | 3 | $this->ref2 = $ref2; |
|
| 169 | } |
||
| 170 | |||
| 171 | 1 | public function getConsolidationRef(): ?string |
|
| 172 | { |
||
| 173 | 1 | return $this->consolidationRef; |
|
| 174 | } |
||
| 175 | |||
| 176 | 1 | public function setConsolidationRef(string $consolidationRef): void |
|
| 177 | { |
||
| 178 | 1 | $this->consolidationRef = $consolidationRef; |
|
| 179 | } |
||
| 180 | |||
| 181 | 1 | public function getRequireUnsuccessfulDeliveryStickerImage(): bool |
|
| 182 | { |
||
| 183 | 1 | return $this->requireUnsuccessfulDeliveryStickerImage; |
|
| 184 | } |
||
| 185 | |||
| 186 | 1 | public function setRequireUnsuccessfulDeliveryStickerImage(bool $requireUnsuccessfulDeliveryStickerImage): void |
|
| 187 | { |
||
| 188 | 1 | $this->requireUnsuccessfulDeliveryStickerImage = $requireUnsuccessfulDeliveryStickerImage; |
|
| 189 | } |
||
| 190 | |||
| 191 | 2 | public function toArray(): array |
|
| 192 | { |
||
| 193 | 2 | return [ |
|
| 194 | 2 | 'service' => $this->service->toArray(), // ok |
|
| 195 | 2 | 'content' => $this->content->toArray(), // ok |
|
| 196 | 2 | 'payment' => $this->payment->toArray(), // ok |
|
| 197 | 2 | 'sender' => $this->sender->toArray(), // ok |
|
| 198 | /* "sender" => [ |
||
| 199 | "phone1" => [ |
||
| 200 | "number" => "0888323020" |
||
| 201 | ], |
||
| 202 | "contactName" => "VASIL DAKOV", |
||
| 203 | "email" => "[email protected]" |
||
| 204 | ], */ |
||
| 205 | 2 | 'recipient' => $this->recipient->toArray(), // ok |
|
| 206 | 2 | 'ref1' => $this->ref1, |
|
| 207 | 2 | ]; |
|
| 208 | } |
||
| 209 | } |
||
| 210 |