PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Legacy / Models / InvoiceQuery.php

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

96 lines 1.9 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 * Describes query criteria for searching invoices.
11 */
12 class InvoiceQuery implements \JsonSerializable
13 {
14 /**
15 * @var InvoiceFilter
16 */
17 private $filter;
18
19 /**
20 * @var InvoiceSort|null
21 */
22 private $sort;
23
24 /**
25 * @param InvoiceFilter $filter
26 */
27 public function __construct(InvoiceFilter $filter)
28 {
29 $this->filter = $filter;
30 }
31
32 /**
33 * Returns Filter.
34 * Describes query filters to apply.
35 */
36 public function getFilter(): InvoiceFilter
37 {
38 return $this->filter;
39 }
40
41 /**
42 * Sets Filter.
43 * Describes query filters to apply.
44 *
45 * @required
46 * @maps filter
47 */
48 public function setFilter(InvoiceFilter $filter): void
49 {
50 $this->filter = $filter;
51 }
52
53 /**
54 * Returns Sort.
55 * Identifies the sort field and sort order.
56 */
57 public function getSort(): ?InvoiceSort
58 {
59 return $this->sort;
60 }
61
62 /**
63 * Sets Sort.
64 * Identifies the sort field and sort order.
65 *
66 * @maps sort
67 */
68 public function setSort(?InvoiceSort $sort): void
69 {
70 $this->sort = $sort;
71 }
72
73 /**
74 * Encode this object to JSON
75 *
76 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
77 * are set. (default: false)
78 *
79 * @return array|stdClass
80 */
81 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
82 public function jsonSerialize(bool $asArrayWhenEmpty = false)
83 {
84 $json = [];
85 $json['filter'] = $this->filter;
86 if (isset($this->sort)) {
87 $json['sort'] = $this->sort;
88 }
89 $json = array_filter($json, function ($val) {
90 return $val !== null;
91 });
92
93 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
94 }
95 }
96