| @@ 149-167 (lines=19) @@ | ||
| 146 | * |
|
| 147 | * @return mixed |
|
| 148 | */ |
|
| 149 | public function getPunchesFromDay($day, $month, $year) |
|
| 150 | { |
|
| 151 | $date = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); |
|
| 152 | list($year, $month, $day) = explode('-', $date); |
|
| 153 | ||
| 154 | if ($day > 19) { |
|
| 155 | $month++; |
|
| 156 | } |
|
| 157 | ||
| 158 | if ($month > 12) { |
|
| 159 | $month = 1; |
|
| 160 | $year++; |
|
| 161 | } |
|
| 162 | $punches = $this->getPunches($month, $year); |
|
| 163 | ||
| 164 | return array_filter($punches['punches'], function (\DateTime $punchDateTime) use ($day) { |
|
| 165 | return (int) $punchDateTime->format('d') === (int) $day; |
|
| 166 | }); |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Gets the employee name. |
|
| @@ 161-179 (lines=19) @@ | ||
| 158 | * |
|
| 159 | * @return mixed |
|
| 160 | */ |
|
| 161 | public function getPunchesFromDay($day, $month, $year) |
|
| 162 | { |
|
| 163 | $date = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); |
|
| 164 | list($year, $month, $day) = explode('-', $date); |
|
| 165 | ||
| 166 | if ($day > 19) { |
|
| 167 | $month++; |
|
| 168 | } |
|
| 169 | ||
| 170 | if ($month > 12) { |
|
| 171 | $month = 1; |
|
| 172 | $year++; |
|
| 173 | } |
|
| 174 | $punches = $this->getPunches($month, $year); |
|
| 175 | ||
| 176 | return array_filter($punches['punches'], function (\DateTime $punchDateTime) use ($day) { |
|
| 177 | return (int) $punchDateTime->format('d') === (int) $day; |
|
| 178 | }); |
|
| 179 | } |
|
| 180 | ||
| 181 | /** |
|
| 182 | * Gets the employee name. |
|