GetOne   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

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