ParamMapperException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 16
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A noParamFound() 0 6 1
A paramEmpty() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Eps\Req2CmdBundle\Exception;
5
6
use JMS\Serializer\Exception\LogicException;
7
8
final class ParamMapperException extends LogicException implements Req2CmdExceptionInterface
9
{
10
    public static function noParamFound(string $paramName, \Throwable $previous = null): self
11
    {
12
        $excCode = 101;
13
        $message = sprintf('Parameter "%s" is required and it\'s missing in your request', $paramName);
14
        return new self($message, $excCode, $previous);
15
    }
16
17
    public static function paramEmpty(string $paramName, \Throwable $previous = null): self
18
    {
19
        $excCode = 102;
20
        $message = sprintf('The value of the parameter "%s" cannot be empty', $paramName);
21
        return new self($message, $excCode, $previous);
22
    }
23
}
24