Passed
Push — master ( 1fb483...35eebd )
by Roman
04:31
created

LanguagesAction::__invoke()   A

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\Dictionary\Features\Languages;
6
7
use App\Dictionary\Features\Languages\Response\Error\ErrorFactory;
8
use App\Dictionary\Features\Languages\Response\FailedApiResponse;
9
use App\Dictionary\Features\Languages\Response\ResponseInterface;
10
use App\Dictionary\Features\Languages\Response\SuccessApiResponse;
11
use App\Dictionary\Features\Languages\Storage\NotFoundSupportedLanguagesException;
12
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...
13
14
/**
15
 * @IgnoreAnnotation("OA\Get")
16
 * @IgnoreAnnotation("OA\Response")
17
 * @IgnoreAnnotation("OA\Parameter")
18
 * @IgnoreAnnotation("OA\Schema")
19
 */
20
final class LanguagesAction
21
{
22
    /**
23
     * @OA\Get(
24
     *     tags={"Dictionary"},
25
     *     path="/api/dictionary/languages",
26
     *     description="Supported languages",
27
     *     @OA\Response(response="default", description="Supported languages list"),
28
     * )
29
     */
30
    public function __invoke(SupportedLanguages $supportedLanguages): ResponseInterface
31
    {
32
        try {
33
            return new SuccessApiResponse($supportedLanguages->languages());
34
        } catch (NotFoundSupportedLanguagesException) {
35
            return new FailedApiResponse(ErrorFactory::emptyDictionary());
36
        }
37
    }
38
}
39