UpdateAction   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 8
c 0
b 0
f 0
dl 0
loc 17
ccs 2
cts 2
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateAction() 0 10 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/Rest/Traits/Actions/Anon/UpdateAction.php
5
 *
6
 * @author TLe, Tarmo Leppänen <[email protected]>
7
 */
8
9
namespace App\Rest\Traits\Actions\Anon;
10
11
use App\DTO\RestDtoInterface;
12
use App\Rest\Traits\Methods\UpdateMethod;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\HttpFoundation\Response;
15
use Symfony\Component\Routing\Annotation\Route;
16
use Symfony\Component\Routing\Requirement\Requirement;
17
use Throwable;
18
19
/**
20
 * Trait UpdateAction
21
 *
22
 * Trait to add 'updateAction' for REST controllers for anonymous users.
23
 *
24
 * @see \App\Rest\Traits\Methods\UpdateMethod for detailed documents.
25
 *
26
 * @package App\Rest\Traits\Actions\Anon
27
 * @author TLe, Tarmo Leppänen <[email protected]>
28
 */
29
trait UpdateAction
30
{
31
    use UpdateMethod;
32
33
    /**
34
     * @throws Throwable
35
     */
36 2
    #[Route(
37
        path: '/{id}',
38
        requirements: [
39
            'id' => Requirement::UUID_V1,
40
        ],
41
        methods: [Request::METHOD_PUT],
42
    )]
43
    public function updateAction(Request $request, RestDtoInterface $restDto, string $id): Response
44
    {
45 2
        return $this->updateMethod($request, $restDto, $id);
46
    }
47
}
48