PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / vendor / square / square / src / Legacy / Models / ShiftQuery.php

ShiftQuery.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Legacy/Models/ShiftQuery.php

91 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * The parameters of a `Shift` search query, which includes filter and sort options.
11 */
12 class ShiftQuery implements \JsonSerializable
13 {
14 /**
15 * @var ShiftFilter|null
16 */
17 private $filter;
18
19 /**
20 * @var ShiftSort|null
21 */
22 private $sort;
23
24 /**
25 * Returns Filter.
26 * Defines a filter used in a search for `Shift` records. `AND` logic is
27 * used by Square's servers to apply each filter property specified.
28 */
29 public function getFilter(): ?ShiftFilter
30 {
31 return $this->filter;
32 }
33
34 /**
35 * Sets Filter.
36 * Defines a filter used in a search for `Shift` records. `AND` logic is
37 * used by Square's servers to apply each filter property specified.
38 *
39 * @maps filter
40 */
41 public function setFilter(?ShiftFilter $filter): void
42 {
43 $this->filter = $filter;
44 }
45
46 /**
47 * Returns Sort.
48 * Sets the sort order of search results.
49 */
50 public function getSort(): ?ShiftSort
51 {
52 return $this->sort;
53 }
54
55 /**
56 * Sets Sort.
57 * Sets the sort order of search results.
58 *
59 * @maps sort
60 */
61 public function setSort(?ShiftSort $sort): void
62 {
63 $this->sort = $sort;
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->filter)) {
79 $json['filter'] = $this->filter;
80 }
81 if (isset($this->sort)) {
82 $json['sort'] = $this->sort;
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