LanguagesAction::__invoke()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Crossword\Features\Languages;
6
7
use App\Crossword\Features\Languages\Response\Error\ErrorFactory;
8
use App\Crossword\Features\Languages\Response\FailedApiResponse;
9
use App\Crossword\Features\Languages\Response\ResponseInterface;
10
use App\Crossword\Features\Languages\Response\SuccessApiResponse;
11
use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Annotati...tation\IgnoreAnnotation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
13
/**
14
 * @IgnoreAnnotation("OA\Get")
15
 * @IgnoreAnnotation("OA\Response")
16
 * @IgnoreAnnotation("OA\Parameter")
17
 * @IgnoreAnnotation("OA\Schema")
18
 */
19
final class LanguagesAction
20
{
21
    /**
22
     * @OA\Get(
23
     *     tags={"Crossword"},
24
     *     path="/api/crossword/languages",
25
     *     description="Supported languages",
26
     *     @OA\Response(response="default", description="Supported languages list"),
27
     * )
28
     */
29
    public function __invoke(SupportedLanguages $supportedLanguages): ResponseInterface
30
    {
31
        try {
32
            return new SuccessApiResponse($supportedLanguages->receive());
33
        } catch (NotFoundSupportedLanguagesException) {
34
            return new FailedApiResponse(ErrorFactory::languageIsNotFound());
35
        }
36
    }
37
}
38