Completed
Pull Request — master (#2)
by
unknown
04:49
created

ServiceException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A invalidServiceData() 0 6 1
1
<?php
2
3
namespace TheAentMachine\Service\Exception;
4
5
use Opis\JsonSchema\ValidationError;
6
7
class ServiceException extends \Exception
8
{
9
    /**
10
     * @param ValidationError $vError
11
     * @return ServiceException
12
     */
13
    public static function invalidServiceData(ValidationError $vError): ServiceException
14
    {
15
        $message = 'Invalid service data' . PHP_EOL
16
            . 'Error: ' . $vError->keyword() . PHP_EOL
17
            . json_encode($vError->keywordArgs(), JSON_PRETTY_PRINT);
18
        return new self($message);
19
    }
20
}
21