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