PluginProbe
Packeta / 2.3.1
Packeta v2.3.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Core / Api / Soap / Response / CreatePacket.php

CreatePacket.php in Packeta 2.3.1, at src/Packetery/Core/Api/Soap/Response/CreatePacket.php

101 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class CreatePacket.
4 *
5 * @package Packetery\Api\Soap\Response
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Core\Api\Soap\Response;
11
12 /**
13 * Class CreatePacket.
14 *
15 * @package Packetery\Api\Soap\Response
16 */
17 class CreatePacket extends BaseResponse {
18
19 /**
20 * Barcode without leading Z.
21 *
22 * @var string
23 */
24 private $id;
25
26 /**
27 * Barcode with leading Z.
28 *
29 * @var string
30 */
31 private $barcode;
32
33 /**
34 * Packet attributes errors.
35 *
36 * @var string[]
37 */
38 private $validationErrors;
39
40 /**
41 * Sets id.
42 *
43 * @param string $id Id.
44 */
45 public function setId( string $id ): void {
46 $this->id = $id;
47 }
48
49 /**
50 * Sets barcode.
51 *
52 * @param string $barcode Barcode.
53 */
54 public function setBarcode( string $barcode ): void {
55 $this->barcode = $barcode;
56 }
57
58 /**
59 * Sets errors.
60 *
61 * @param string[] $errors Errors.
62 */
63 public function setValidationErrors( array $errors ): void {
64 $this->validationErrors = $errors;
65 }
66
67 /**
68 * Gets id.
69 *
70 * @return string
71 */
72 public function getId(): string {
73 return $this->id;
74 }
75
76 /**
77 * Gets barcode.
78 *
79 * @return string
80 */
81 public function getBarcode(): string {
82 return $this->barcode;
83 }
84
85 /**
86 * Gets all errors as string.
87 *
88 * @param bool $prependFaultString Prepend fault string.
89 *
90 * @return string
91 */
92 public function getErrorsAsString( bool $prependFaultString = true ): string {
93 $allErrors = $this->validationErrors;
94 if ( $prependFaultString ) {
95 array_unshift( $allErrors, $this->getFaultString() );
96 }
97
98 return implode( ', ', $allErrors );
99 }
100 }
101