Update   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller\User;
6
7
use Slim\Http\Request;
8
use Slim\Http\Response;
9
10
final class Update extends Base
11
{
12 4
    /**
13
     * @param array<string> $args
14 4
     */
15 4
    public function __invoke(
16 4
        Request $request,
17 3
        Response $response,
18
        array $args
19 1
    ): Response {
20
        $input = (array) $request->getParsedBody();
21
        $id = (int) $args['id'];
22
        $userIdLogged = $this->getAndValidateUserId($input);
23
        $this->checkUserPermissions($id, $userIdLogged);
24
        $user = $this->getServiceUpdateUser()->update($input, $id);
25
26
        return $this->jsonResponse($response, 'success', $user, 200);
27
    }
28
}
29