charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
ListOrderCustomAttributeDefinitionsResponse.php
ListOrderCustomAttributeDefinitionsResponse.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Legacy/Models/ListOrderCustomAttributeDefinitionsResponse.php
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Square\Legacy\Models; |
| 6 | |
| 7 | use stdClass; |
| 8 | |
| 9 | /** |
| 10 | * Represents a response from listing order custom attribute definitions. |
| 11 | */ |
| 12 | class ListOrderCustomAttributeDefinitionsResponse implements \JsonSerializable |
| 13 | { |
| 14 | /** |
| 15 | * @var CustomAttributeDefinition[] |
| 16 | */ |
| 17 | private $customAttributeDefinitions; |
| 18 | |
| 19 | /** |
| 20 | * @var string|null |
| 21 | */ |
| 22 | private $cursor; |
| 23 | |
| 24 | /** |
| 25 | * @var Error[]|null |
| 26 | */ |
| 27 | private $errors; |
| 28 | |
| 29 | /** |
| 30 | * @param CustomAttributeDefinition[] $customAttributeDefinitions |
| 31 | */ |
| 32 | public function __construct(array $customAttributeDefinitions) |
| 33 | { |
| 34 | $this->customAttributeDefinitions = $customAttributeDefinitions; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Returns Custom Attribute Definitions. |
| 39 | * The retrieved custom attribute definitions. If no custom attribute definitions are found, Square |
| 40 | * returns an empty object (`{}`). |
| 41 | * |
| 42 | * @return CustomAttributeDefinition[] |
| 43 | */ |
| 44 | public function getCustomAttributeDefinitions(): array |
| 45 | { |
| 46 | return $this->customAttributeDefinitions; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Sets Custom Attribute Definitions. |
| 51 | * The retrieved custom attribute definitions. If no custom attribute definitions are found, Square |
| 52 | * returns an empty object (`{}`). |
| 53 | * |
| 54 | * @required |
| 55 | * @maps custom_attribute_definitions |
| 56 | * |
| 57 | * @param CustomAttributeDefinition[] $customAttributeDefinitions |
| 58 | */ |
| 59 | public function setCustomAttributeDefinitions(array $customAttributeDefinitions): void |
| 60 | { |
| 61 | $this->customAttributeDefinitions = $customAttributeDefinitions; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Returns Cursor. |
| 66 | * The cursor to provide in your next call to this endpoint to retrieve the next page of results for |
| 67 | * your original request. |
| 68 | * This field is present only if the request succeeded and additional results are available. |
| 69 | * For more information, see [Pagination](https://developer.squareup.com/docs/working-with- |
| 70 | * apis/pagination). |
| 71 | */ |
| 72 | public function getCursor(): ?string |
| 73 | { |
| 74 | return $this->cursor; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Sets Cursor. |
| 79 | * The cursor to provide in your next call to this endpoint to retrieve the next page of results for |
| 80 | * your original request. |
| 81 | * This field is present only if the request succeeded and additional results are available. |
| 82 | * For more information, see [Pagination](https://developer.squareup.com/docs/working-with- |
| 83 | * apis/pagination). |
| 84 | * |
| 85 | * @maps cursor |
| 86 | */ |
| 87 | public function setCursor(?string $cursor): void |
| 88 | { |
| 89 | $this->cursor = $cursor; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Returns Errors. |
| 94 | * Any errors that occurred during the request. |
| 95 | * |
| 96 | * @return Error[]|null |
| 97 | */ |
| 98 | public function getErrors(): ?array |
| 99 | { |
| 100 | return $this->errors; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * Sets Errors. |
| 105 | * Any errors that occurred during the request. |
| 106 | * |
| 107 | * @maps errors |
| 108 | * |
| 109 | * @param Error[]|null $errors |
| 110 | */ |
| 111 | public function setErrors(?array $errors): void |
| 112 | { |
| 113 | $this->errors = $errors; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Encode this object to JSON |
| 118 | * |
| 119 | * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 120 | * are set. (default: false) |
| 121 | * |
| 122 | * @return array|stdClass |
| 123 | */ |
| 124 | #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 125 | public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 126 | { |
| 127 | $json = []; |
| 128 | $json['custom_attribute_definitions'] = $this->customAttributeDefinitions; |
| 129 | if (isset($this->cursor)) { |
| 130 | $json['cursor'] = $this->cursor; |
| 131 | } |
| 132 | if (isset($this->errors)) { |
| 133 | $json['errors'] = $this->errors; |
| 134 | } |
| 135 | $json = array_filter($json, function ($val) { |
| 136 | return $val !== null; |
| 137 | }); |
| 138 | |
| 139 | return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 140 | } |
| 141 | } |
| 142 |