| 1 | <?php | ||
| 9 | final class CourseSearch | ||
| 10 | { | ||
| 11 | /** | ||
| 12 | * @var int | ||
| 13 | */ | ||
| 14 | private $page = 1; | ||
| 15 | |||
| 16 | /** | ||
| 17 | * @var int | ||
| 18 | */ | ||
| 19 | private $perPage = 20; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @var string|null | ||
| 23 | */ | ||
| 24 | private $sort; | ||
| 25 | |||
| 26 | const SORT_NAME = 'name'; | ||
| 27 | |||
| 28 | const SORT = [ | ||
| 29 | self::SORT_NAME, | ||
| 30 | ]; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * @var string | ||
| 34 | */ | ||
| 35 | private $order = self::ORDER_ASC; | ||
| 36 | |||
| 37 | const ORDER_ASC = 'asc'; | ||
| 38 | const ORDER_DESC = 'desc'; | ||
| 39 | |||
| 40 | const ORDER = [ | ||
| 41 | self::ORDER_ASC, | ||
| 42 | self::ORDER_DESC, | ||
| 43 | ]; | ||
| 44 | |||
| 45 | /** | ||
| 46 | * @var int | ||
| 47 | */ | ||
| 48 | private $pages; | ||
| 49 | |||
| 50 | /** | ||
| 51 | * @var int | ||
| 52 | */ | ||
| 53 | private $count; | ||
| 54 | |||
| 55 | /** | ||
| 56 | * @var Course[] | ||
| 57 | */ | ||
| 58 | private $courses; | ||
| 59 | |||
| 60 | 3 | private function __construct() | |
| 63 | |||
| 64 | /** | ||
| 65 | * @return CourseSearch | ||
| 66 | */ | ||
| 67 | 3 | public static function create(): self | |
| 71 | |||
| 72 | /** | ||
| 73 | * @return int | ||
| 74 | */ | ||
| 75 | 2 | public function getPage(): int | |
| 79 | |||
| 80 | /** | ||
| 81 | * @param int $page | ||
| 82 | * | ||
| 83 | * @return self | ||
| 84 | */ | ||
| 85 | 2 | public function setPage(int $page): self | |
| 91 | |||
| 92 | /** | ||
| 93 | * @return int | ||
| 94 | */ | ||
| 95 | 2 | public function getPerPage(): int | |
| 99 | |||
| 100 | /** | ||
| 101 | * @param int $perPage | ||
| 102 | * | ||
| 103 | * @return self | ||
| 104 | */ | ||
| 105 | 1 | public function setPerPage(int $perPage): self | |
| 111 | |||
| 112 | /** | ||
| 113 | * @return null|string | ||
| 114 | */ | ||
| 115 | 2 | public function getSort() | |
| 119 | |||
| 120 | /** | ||
| 121 | * @param null|string $sort | ||
| 122 | * | ||
| 123 | * @return self | ||
| 124 | */ | ||
| 125 | 1 | public function setSort(string $sort = null): self | |
| 131 | |||
| 132 | /** | ||
| 133 | * @return string | ||
| 134 | */ | ||
| 135 | 2 | public function getOrder() | |
| 139 | |||
| 140 | /** | ||
| 141 | * @param string $order | ||
| 142 | * | ||
| 143 | * @return self | ||
| 144 | */ | ||
| 145 | 1 | public function setOrder(string $order): self | |
| 151 | |||
| 152 | /** | ||
| 153 | * @return int | ||
| 154 | */ | ||
| 155 | 1 | public function getPages(): int | |
| 159 | |||
| 160 | /** | ||
| 161 | * @param int $pages | ||
| 162 | * | ||
| 163 | * @return self | ||
| 164 | */ | ||
| 165 | 1 | public function setPages(int $pages): self | |
| 171 | |||
| 172 | /** | ||
| 173 | * @return int | ||
| 174 | */ | ||
| 175 | 1 | public function getCount(): int | |
| 179 | |||
| 180 | /** | ||
| 181 | * @param int $count | ||
| 182 | * | ||
| 183 | * @return self | ||
| 184 | */ | ||
| 185 | 1 | public function setCount(int $count): self | |
| 191 | |||
| 192 | /** | ||
| 193 | * @return Course[] | ||
| 194 | */ | ||
| 195 | 1 | public function getCourses(): array | |
| 199 | |||
| 200 | /** | ||
| 201 | * @param Course[] $courses | ||
| 202 | * | ||
| 203 | * @return self | ||
| 204 | */ | ||
| 205 | 1 | public function setCourses(array $courses): self | |
| 211 | } | ||
| 212 |