charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
DeprecatedCreateDisputeEvidenceTextResponse.php
DeprecatedCreateDisputeEvidenceTextResponse.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/DeprecatedCreateDisputeEvidenceTextResponse.php
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Square\Legacy\Models; |
| 6 | |
| 7 | use stdClass; |
| 8 | |
| 9 | /** |
| 10 | * Defines the fields in a `DeprecatedCreateDisputeEvidenceText` response. |
| 11 | */ |
| 12 | class DeprecatedCreateDisputeEvidenceTextResponse implements \JsonSerializable |
| 13 | { |
| 14 | /** |
| 15 | * @var Error[]|null |
| 16 | */ |
| 17 | private $errors; |
| 18 | |
| 19 | /** |
| 20 | * @var DisputeEvidence|null |
| 21 | */ |
| 22 | private $evidence; |
| 23 | |
| 24 | /** |
| 25 | * Returns Errors. |
| 26 | * Any errors that occurred during the request. |
| 27 | * |
| 28 | * @return Error[]|null |
| 29 | */ |
| 30 | public function getErrors(): ?array |
| 31 | { |
| 32 | return $this->errors; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Sets Errors. |
| 37 | * Any errors that occurred during the request. |
| 38 | * |
| 39 | * @maps errors |
| 40 | * |
| 41 | * @param Error[]|null $errors |
| 42 | */ |
| 43 | public function setErrors(?array $errors): void |
| 44 | { |
| 45 | $this->errors = $errors; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns Evidence. |
| 50 | */ |
| 51 | public function getEvidence(): ?DisputeEvidence |
| 52 | { |
| 53 | return $this->evidence; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Sets Evidence. |
| 58 | * |
| 59 | * @maps evidence |
| 60 | */ |
| 61 | public function setEvidence(?DisputeEvidence $evidence): void |
| 62 | { |
| 63 | $this->evidence = $evidence; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Encode this object to JSON |
| 68 | * |
| 69 | * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 70 | * are set. (default: false) |
| 71 | * |
| 72 | * @return array|stdClass |
| 73 | */ |
| 74 | #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 75 | public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 76 | { |
| 77 | $json = []; |
| 78 | if (isset($this->errors)) { |
| 79 | $json['errors'] = $this->errors; |
| 80 | } |
| 81 | if (isset($this->evidence)) { |
| 82 | $json['evidence'] = $this->evidence; |
| 83 | } |
| 84 | $json = array_filter($json, function ($val) { |
| 85 | return $val !== null; |
| 86 | }); |
| 87 | |
| 88 | return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 89 | } |
| 90 | } |
| 91 |