Handler.php
1 month ago
ListingDateRangeFilterTrait.php
1 month ago
ListingDefinition.php
1 year ago
ListingRepository.php
1 month ago
PageLimit.php
2 years ago
index.php
3 years ago
ListingDefinition.php
96 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\Listing; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | class ListingDefinition { |
| 9 | /** @var string|null */ |
| 10 | private $group; |
| 11 | |
| 12 | /** @var array */ |
| 13 | private $filters; |
| 14 | |
| 15 | /** @var string|null */ |
| 16 | private $search; |
| 17 | |
| 18 | /** @var array */ |
| 19 | private $parameters; |
| 20 | |
| 21 | /** @var string */ |
| 22 | private $sortBy; |
| 23 | |
| 24 | /** @var string */ |
| 25 | private $sortOrder; |
| 26 | |
| 27 | /** @var int */ |
| 28 | private $offset; |
| 29 | |
| 30 | /** @var int */ |
| 31 | private $limit; |
| 32 | |
| 33 | /** @var int[] */ |
| 34 | private $selection; |
| 35 | |
| 36 | public function __construct( |
| 37 | ?string $group = null, |
| 38 | array $filters = [], |
| 39 | ?string $search = null, |
| 40 | array $parameters = [], |
| 41 | string $sortBy = 'created_at', |
| 42 | string $sortOrder = 'desc', |
| 43 | int $offset = 0, |
| 44 | int $limit = 20, |
| 45 | array $selection = [] |
| 46 | ) { |
| 47 | $this->group = $group; |
| 48 | $this->filters = $filters; |
| 49 | $this->search = $search; |
| 50 | $this->parameters = $parameters; |
| 51 | $this->sortBy = $sortBy; |
| 52 | $this->sortOrder = $sortOrder; |
| 53 | $this->offset = $offset; |
| 54 | $this->limit = $limit; |
| 55 | $this->selection = array_map('intval', $selection); |
| 56 | } |
| 57 | |
| 58 | /** @return string|null */ |
| 59 | public function getGroup() { |
| 60 | return $this->group; |
| 61 | } |
| 62 | |
| 63 | public function getFilters(): array { |
| 64 | return $this->filters; |
| 65 | } |
| 66 | |
| 67 | /** @return string|null */ |
| 68 | public function getSearch() { |
| 69 | return $this->search; |
| 70 | } |
| 71 | |
| 72 | public function getParameters(): array { |
| 73 | return $this->parameters; |
| 74 | } |
| 75 | |
| 76 | public function getSortBy(): string { |
| 77 | return $this->sortBy; |
| 78 | } |
| 79 | |
| 80 | public function getSortOrder(): string { |
| 81 | return $this->sortOrder; |
| 82 | } |
| 83 | |
| 84 | public function getOffset(): int { |
| 85 | return $this->offset; |
| 86 | } |
| 87 | |
| 88 | public function getLimit(): int { |
| 89 | return $this->limit; |
| 90 | } |
| 91 | |
| 92 | public function getSelection(): array { |
| 93 | return $this->selection; |
| 94 | } |
| 95 | } |
| 96 |