| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models; |
| 6 |
|
| 7 |
use stdClass; |
| 8 |
|
| 9 |
class OrderUpdatedObject implements \JsonSerializable |
| 10 |
{ |
| 11 |
/** |
| 12 |
* @var OrderUpdated|null |
| 13 |
*/ |
| 14 |
private $orderUpdated; |
| 15 |
|
| 16 |
/** |
| 17 |
* Returns Order Updated. |
| 18 |
*/ |
| 19 |
public function getOrderUpdated(): ?OrderUpdated |
| 20 |
{ |
| 21 |
return $this->orderUpdated; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Sets Order Updated. |
| 26 |
* |
| 27 |
* @maps order_updated |
| 28 |
*/ |
| 29 |
public function setOrderUpdated(?OrderUpdated $orderUpdated): void |
| 30 |
{ |
| 31 |
$this->orderUpdated = $orderUpdated; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Encode this object to JSON |
| 36 |
* |
| 37 |
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields |
| 38 |
* are set. (default: false) |
| 39 |
* |
| 40 |
* @return array|stdClass |
| 41 |
*/ |
| 42 |
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) |
| 43 |
public function jsonSerialize(bool $asArrayWhenEmpty = false) |
| 44 |
{ |
| 45 |
$json = []; |
| 46 |
if (isset($this->orderUpdated)) { |
| 47 |
$json['order_updated'] = $this->orderUpdated; |
| 48 |
} |
| 49 |
$json = array_filter($json, function ($val) { |
| 50 |
return $val !== null; |
| 51 |
}); |
| 52 |
|
| 53 |
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; |
| 54 |
} |
| 55 |
} |
| 56 |
|