| 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 a bulk create request containing the created `TeamMember` objects or |
| 11 |
* error messages. |
| 12 |
*/ |
| 13 |
class BulkCreateTeamMembersResponse implements \JsonSerializable |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @var array<string,CreateTeamMemberResponse>|null |
| 17 |
*/ |
| 18 |
private $teamMembers; |
| 19 |
|
| 20 |
/** |
| 21 |
* @var Error[]|null |
| 22 |
*/ |
| 23 |
private $errors; |
| 24 |
|
| 25 |
/** |
| 26 |
* Returns Team Members. |
| 27 |
* The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the |
| 28 |
* `CreateTeamMemberRequest`. |
| 29 |
* |
| 30 |
* @return array<string,CreateTeamMemberResponse>|null |
| 31 |
*/ |
| 32 |
public function getTeamMembers(): ?array |
| 33 |
{ |
| 34 |
return $this->teamMembers; |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Sets Team Members. |
| 39 |
* The successfully created `TeamMember` objects. Each key is the `idempotency_key` that maps to the |
| 40 |
* `CreateTeamMemberRequest`. |
| 41 |
* |
| 42 |
* @maps team_members |
| 43 |
* |
| 44 |
* @param array<string,CreateTeamMemberResponse>|null $teamMembers |
| 45 |
*/ |
| 46 |
public function setTeamMembers(?array $teamMembers): void |
| 47 |
{ |
| 48 |
$this->teamMembers = $teamMembers; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Returns Errors. |
| 53 |
* The errors that occurred during the request. |
| 54 |
* |
| 55 |
* @return Error[]|null |
| 56 |
*/ |
| 57 |
public function getErrors(): ?array |
| 58 |
{ |
| 59 |
return $this->errors; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Sets Errors. |
| 64 |
* The errors that occurred during the request. |
| 65 |
* |
| 66 |
* @maps errors |
| 67 |
* |
| 68 |
* @param Error[]|null $errors |
| 69 |
*/ |
| 70 |
public function setErrors(?array $errors): void |
| 71 |
{ |
| 72 |
$this->errors = $errors; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Encode this object to JSON |
| 77 |
* |
| 78 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 79 |
* are set. (default: false) |
| 80 |
* |
| 81 |
* @return array|stdClass |
| 82 |
*/ |
| 83 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 84 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 85 |
{ |
| 86 |
$json = []; |
| 87 |
if (isset($this->teamMembers)) { |
| 88 |
$json['team_members'] = $this->teamMembers; |
| 89 |
} |
| 90 |
if (isset($this->errors)) { |
| 91 |
$json['errors'] = $this->errors; |
| 92 |
} |
| 93 |
$json = array_filter($json, function ($val) { |
| 94 |
return $val !== null; |
| 95 |
}); |
| 96 |
|
| 97 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 98 |
} |
| 99 |
} |
| 100 |
|