CreateAction   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createAction() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * /src/Rest/Traits/Actions/Anon/CreateAction.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\CreateMethod;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\HttpFoundation\Response;
15
use Symfony\Component\Routing\Annotation\Route;
16
use Throwable;
17
18
/**
19
 * Trait CreateAction
20
 *
21
 * Trait to add 'createAction' for REST controllers for anonymous users.
22
 *
23
 * @see \App\Rest\Traits\Methods\CreateMethod for detailed documents.
24
 *
25
 * @package App\Rest\Traits\Actions\Anon
26
 * @author TLe, Tarmo Leppänen <[email protected]>
27
 */
28
trait CreateAction
29
{
30
    use CreateMethod;
31
32
    /**
33
     * @throws Throwable
34
     */
35 2
    #[Route(
36
        path: '',
37
        methods: [Request::METHOD_POST],
38
    )]
39
    public function createAction(Request $request, RestDtoInterface $restDto): Response
40
    {
41 2
        return $this->createMethod($request, $restDto);
42
    }
43
}
44