Test Setup Failed
Push — main ( c2f1dd...5e437f )
by Fractal
11:05
created

ValidationFormatter::formatErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FRZB\Component\RequestMapper\ExceptionFormatter\Formatter;
6
7
use FRZB\Component\RequestMapper\Data\ErrorContract;
8
use FRZB\Component\RequestMapper\Data\FormattedError;
9
use FRZB\Component\RequestMapper\Exception\ValidationException;
0 ignored issues
show
Bug introduced by
The type FRZB\Component\RequestMa...ion\ValidationException 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...
10
use FRZB\Component\RequestMapper\Locator\ExceptionFormatterLocatorInterface as ExceptionFormatterLocator;
11
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
12
use Symfony\Component\HttpFoundation\Response;
13
14
#[AutoconfigureTag(ExceptionFormatterLocator::EXCEPTION_FORMATTERS_TAG)]
15
class ValidationFormatter implements FormatterInterface
16 1
{
17
    public function __invoke(ValidationException $e): ErrorContract
18 1
    {
19
        return new FormattedError($e->getMessage(), Response::HTTP_UNPROCESSABLE_ENTITY, $e->getFormattedErrors(), $e->getTrace());
20 1
    }
21
22
    public static function getExceptionClass(): string
23 1
    {
24
        return ValidationException::class;
25 1
    }
26
27
    public static function getPriority(): int
28 1
    {
29
        return 1;
30 1
    }
31
}
32