Code Duplication    Length = 19-19 lines in 2 locations

src/HttpApi.php 1 location

@@ 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.

src/RestApi.php 1 location

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