UpdateShiftInput::__invoke()   A
last analyzed

Complexity

Conditions 5
Paths 16

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.5222
c 0
b 0
f 0
cc 5
nc 16
nop 1
1
<?php
2
3
namespace Scheduler\Web\Radar\Input;
4
5
use Psr\Http\Message\ServerRequestInterface as Request;
6
7
class UpdateShiftInput extends Input
8
{
9
    public function __invoke(Request $request)
10
    {
11
        $currentUser = $this->getCurrentUser($request);
12
        $shiftId = (int) $request->getAttribute('id');
13
14
        $body = $request->getParsedBody();
15
        $employeeId = isset($body->employee_id) ? (int) $body->employee_id : null;
16
        $start = isset($body->start_time) ? $body->start_time : '';
17
        $end = isset($body->end_time) ? $body->end_time : '';
18
        $break = isset($body->break) ? $body->break : '';
19
20
        return [$currentUser, $shiftId, $employeeId, $start, $end, $break];
21
    }
22
}
23