UpdateResponseController::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace App\Http\Controllers\Responses;
6
7
use App\Http\Controllers\Controller;
8
use Illuminate\Http\Request;
9
use Illuminate\Http\Response;
10
use TrophyForum\Responses\Application\Update\UpdateResponseCommand;
11
use TrophyForum\Responses\Application\Update\UpdateResponseCommandHandler;
12
13
final class UpdateResponseController extends Controller
14
{
15
    public function __invoke(string $responseId, Request $request): Response
16
    {
17
        $this->bus->addHandler(UpdateResponseCommand::class, UpdateResponseCommandHandler::class);
18
19
        $this->bus->dispatch(
20
            new UpdateResponseCommand(
21
                $responseId,
22
                $request->get('content')
0 ignored issues
show
Bug introduced by
It seems like $request->get('content') can also be of type null; however, parameter $content of TrophyForum\Responses\Ap...eCommand::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
                /** @scrutinizer ignore-type */ $request->get('content')
Loading history...
23
            )
24
        );
25
26
        return Response::create(null, Response::HTTP_OK);
27
    }
28
}
29