| @@ 11-69 (lines=59) @@ | ||
| 8 | * Class Sort |
|
| 9 | * @package PayGo\Transactions\Contracts |
|
| 10 | */ |
|
| 11 | class Sort implements \JsonSerializable |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | private $field; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $mode = SortModeConst::ASC; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @return string |
|
| 25 | */ |
|
| 26 | public function getField() |
|
| 27 | { |
|
| 28 | return $this->field; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param string $field |
|
| 33 | * @return Sort |
|
| 34 | */ |
|
| 35 | public function setField($field) |
|
| 36 | { |
|
| 37 | $this->field = $field; |
|
| 38 | return $this; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | public function getMode() |
|
| 45 | { |
|
| 46 | return $this->mode; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @param string $mode |
|
| 51 | * @return Sort |
|
| 52 | */ |
|
| 53 | public function setMode($mode) |
|
| 54 | { |
|
| 55 | $this->mode = $mode; |
|
| 56 | return $this; |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @return array|mixed |
|
| 61 | */ |
|
| 62 | public function jsonSerialize() |
|
| 63 | { |
|
| 64 | return array_filter([ |
|
| 65 | "Field" => $this->field, |
|
| 66 | "Mode" => $this->mode, |
|
| 67 | ], function($val) { return !empty($val); }); |
|
| 68 | } |
|
| 69 | } |
|
| @@ 12-68 (lines=57) @@ | ||
| 9 | namespace PayGo\Transactions\Contracts\Query; |
|
| 10 | ||
| 11 | ||
| 12 | class Source implements \JsonSerializable |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * @var array |
|
| 16 | */ |
|
| 17 | private $include; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * @var array |
|
| 21 | */ |
|
| 22 | private $exclude; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @return array |
|
| 26 | */ |
|
| 27 | public function getInclude() |
|
| 28 | { |
|
| 29 | return $this->include; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @param array $include |
|
| 34 | * @return Source |
|
| 35 | */ |
|
| 36 | public function setInclude($include) |
|
| 37 | { |
|
| 38 | $this->include = $include; |
|
| 39 | return $this; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return array |
|
| 44 | */ |
|
| 45 | public function getExclude() |
|
| 46 | { |
|
| 47 | return $this->exclude; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @param array $exclude |
|
| 52 | * @return Source |
|
| 53 | */ |
|
| 54 | public function setExclude($exclude) |
|
| 55 | { |
|
| 56 | $this->exclude = $exclude; |
|
| 57 | return $this; |
|
| 58 | } |
|
| 59 | ||
| 60 | public function jsonSerialize() |
|
| 61 | { |
|
| 62 | return array_filter([ |
|
| 63 | "Include" => $this->include, |
|
| 64 | "Exclude" => $this->exclude, |
|
| 65 | ], function($val) { return !empty($val); }); |
|
| 66 | } |
|
| 67 | ||
| 68 | } |
|