1 | <?php |
||
16 | class VideoFilter implements Filterable |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * Page that should be pulled |
||
21 | * |
||
22 | * @var int $page |
||
23 | */ |
||
24 | private $page = 1; |
||
25 | |||
26 | /** |
||
27 | * Query string that should be searched for |
||
28 | * |
||
29 | * @var string $search |
||
30 | */ |
||
31 | private $search; |
||
32 | |||
33 | /** |
||
34 | * Category the videos should belong to |
||
35 | * |
||
36 | * @var string $category |
||
37 | */ |
||
38 | private $category; |
||
39 | |||
40 | /** |
||
41 | * List of tags |
||
42 | * |
||
43 | * @var array $tags |
||
44 | */ |
||
45 | private $tags = []; |
||
46 | |||
47 | /** |
||
48 | * List of stars |
||
49 | * |
||
50 | * @var array $stars |
||
51 | */ |
||
52 | private $stars = []; |
||
53 | |||
54 | /** |
||
55 | * Thumbsize |
||
56 | * |
||
57 | * @var string $thumbsize |
||
58 | */ |
||
59 | private $thumbsize; |
||
60 | |||
61 | /** |
||
62 | * Order by |
||
63 | * |
||
64 | * @var string $orderBy |
||
65 | */ |
||
66 | private $orderBy = OrderBy::NEWEST; |
||
67 | |||
68 | /** |
||
69 | * Period of creation |
||
70 | * |
||
71 | * @var string $period |
||
72 | */ |
||
73 | private $period = Period::ALL_TIME; |
||
74 | |||
75 | /** |
||
76 | * Create new filter instance |
||
77 | * |
||
78 | * @return static |
||
79 | */ |
||
80 | public static function create() |
||
84 | |||
85 | /** |
||
86 | * Search by provided string |
||
87 | * |
||
88 | * @param $search |
||
89 | * |
||
90 | * @return $this |
||
91 | */ |
||
92 | public function search($search) |
||
98 | |||
99 | /** |
||
100 | * Filter results by provided page (works like limit) |
||
101 | * |
||
102 | * @param $page |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | public function page($page) |
||
112 | |||
113 | /** |
||
114 | * Get requested page |
||
115 | * |
||
116 | * Used mostly internally |
||
117 | * |
||
118 | * @return int |
||
119 | */ |
||
120 | public function getRequestedPage() |
||
124 | |||
125 | /** |
||
126 | * Category the videos should belong to |
||
127 | * |
||
128 | * @param $category |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function category($category) |
||
138 | |||
139 | /** |
||
140 | * Filter by provided list of tags |
||
141 | * |
||
142 | * @param array $tags |
||
143 | * |
||
144 | * @return $this |
||
145 | */ |
||
146 | public function tags(array $tags) |
||
152 | |||
153 | /** |
||
154 | * Filter by provided list of stars |
||
155 | * |
||
156 | * @param array $stars |
||
157 | * |
||
158 | * @return $this |
||
159 | */ |
||
160 | public function stars(array $stars) |
||
166 | |||
167 | /** |
||
168 | * Get only provided thumbsizes |
||
169 | * |
||
170 | * @param $thumbsize |
||
171 | * |
||
172 | * @return $this |
||
173 | * @throws \InvalidArgumentException |
||
174 | */ |
||
175 | public function thumbsize($thumbsize) |
||
185 | |||
186 | /** |
||
187 | * Order result by |
||
188 | * |
||
189 | * @param $orderBy |
||
190 | * |
||
191 | * @return $this |
||
192 | * @throws \InvalidArgumentException |
||
193 | */ |
||
194 | public function orderBy($orderBy) |
||
204 | |||
205 | /** |
||
206 | * Get only vidoes created during provided period |
||
207 | * |
||
208 | * @param $period |
||
209 | * |
||
210 | * @return $this |
||
211 | * @throws \InvalidArgumentException |
||
212 | */ |
||
213 | public function period($period) |
||
223 | |||
224 | /** |
||
225 | * @inheritdoc |
||
226 | */ |
||
227 | public function compile() |
||
231 | |||
232 | } |
||
233 |