1 | <?php |
||
12 | class FilterFactory |
||
13 | { |
||
14 | /** |
||
15 | * Returns a filter that returns true if the day and month match, |
||
16 | * false otherwise; the month is represented as an integer (January |
||
17 | * is 1, December is 12) |
||
18 | * |
||
19 | * @param int $month |
||
20 | * @param int $day |
||
21 | * @return callable |
||
22 | * @throws \OutOfBoundsException|\InvalidArgumentException |
||
23 | */ |
||
24 | 30 | public static function monthAndDay($month, $day) |
|
32 | |||
33 | /** |
||
34 | * Returns a filter that returns true if the day, month and day of week |
||
35 | * match, false otherwise; the month and day of week are represented as |
||
36 | * integers (January is 1, December is 12, Sunday is 0, Saturday is 6) |
||
37 | * |
||
38 | * @param int $month |
||
39 | * @param int $day |
||
40 | * @param int $day_of_week |
||
41 | * @return callable |
||
42 | * @throws \OutOfBoundsException|\InvalidArgumentException |
||
43 | */ |
||
44 | 22 | public static function monthAndDayOnDayOfWeek($month, $day, $day_of_week) |
|
61 | |||
62 | /** |
||
63 | * Returns a filter that returns true if the date is the Nth (e.g. 4rd) |
||
64 | * day (e.g. Thursday, as an integer where Sunday is 0 and Saturday is 6) |
||
65 | * of a given month (as an integer where January is 1 and December is 12) |
||
66 | * |
||
67 | * @param int $n |
||
68 | * @param int $day_of_week |
||
69 | * @param int $month |
||
70 | * @return callable |
||
71 | * @throws \OutOfBoundsException|\InvalidArgumentException |
||
72 | */ |
||
73 | 34 | public static function nthDayOfWeekOfMonth($n, $day_of_week, $month) |
|
89 | |||
90 | /** |
||
91 | * Does type and bounds checks for nThDayOfWeekOfMonth() |
||
92 | * |
||
93 | * @param $n |
||
94 | * @param $day_of_week |
||
95 | * @param $month |
||
96 | */ |
||
97 | 34 | protected static function checkNthDayArgs($n, $day_of_week, $month) |
|
115 | |||
116 | /** |
||
117 | * Does type and bounds checks for monthAndDay() |
||
118 | * |
||
119 | * @param $month |
||
120 | * @param $day |
||
121 | */ |
||
122 | 52 | protected static function checkMonthAndDayArgs($month, $day) |
|
140 | } |
||
141 |