Passed
Push — master ( 4ca145...e39a6b )
by Jakub
02:24
created

ParamMapperException::paramEmpty()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
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