| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
/** |
| 10 |
* Defines the body parameters that can be included in a request to the |
| 11 |
* [UpdateCustomerGroup]($e/CustomerGroups/UpdateCustomerGroup) endpoint. |
| 12 |
*/ |
| 13 |
class UpdateCustomerGroupRequest implements \JsonSerializable |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @var CustomerGroup |
| 17 |
*/ |
| 18 |
private $group; |
| 19 |
|
| 20 |
/** |
| 21 |
* @param CustomerGroup $group |
| 22 |
*/ |
| 23 |
public function __construct(CustomerGroup $group) |
| 24 |
{ |
| 25 |
$this->group = $group; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Returns Group. |
| 30 |
* Represents a group of customer profiles. |
| 31 |
* |
| 32 |
* Customer groups can be created, be modified, and have their membership defined using |
| 33 |
* the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. |
| 34 |
*/ |
| 35 |
public function getGroup(): CustomerGroup |
| 36 |
{ |
| 37 |
return $this->group; |
| 38 |
} |
| 39 |
|
| 40 |
/** |
| 41 |
* Sets Group. |
| 42 |
* Represents a group of customer profiles. |
| 43 |
* |
| 44 |
* Customer groups can be created, be modified, and have their membership defined using |
| 45 |
* the Customers API or within the Customer Directory in the Square Seller Dashboard or Point of Sale. |
| 46 |
* |
| 47 |
* @required |
| 48 |
* @maps group |
| 49 |
*/ |
| 50 |
public function setGroup(CustomerGroup $group): void |
| 51 |
{ |
| 52 |
$this->group = $group; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Encode this object to JSON |
| 57 |
* |
| 58 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 59 |
* are set. (default: false) |
| 60 |
* |
| 61 |
* @return array|stdClass |
| 62 |
*/ |
| 63 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 64 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 65 |
{ |
| 66 |
$json = []; |
| 67 |
$json['group'] = $this->group; |
| 68 |
$json = array_filter($json, function ($val) { |
| 69 |
return $val !== null; |
| 70 |
}); |
| 71 |
|
| 72 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 73 |
} |
| 74 |
} |
| 75 |
|