BpostInvalidValueException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 5
crap 1
1
<?php
2
3
namespace Bpost\BpostApiClient\Exception\BpostLogicException;
4
5
use Bpost\BpostApiClient\Exception\BpostLogicException;
6
7
/**
8
 * Class BpostInvalidValueException
9
 * @package Bpost\BpostApiClient\Exception\LogicException
10
 */
11
class BpostInvalidValueException extends BpostLogicException
12
{
13
    /**
14
     * @param string     $key
15
     * @param string     $invalidValue
16
     * @param array      $allowedValues
17
     * @param int        $code
18
     * @param \Exception $previous
0 ignored issues
show
Documentation introduced by
Should the type for parameter $previous not be null|\Exception?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
19
     */
20 18
    public function __construct($key, $invalidValue, array $allowedValues, $code = 0, \Exception $previous = null)
21
    {
22 18
        $message = sprintf(
23 18
            'Invalid value (%1$s) for %2$s, possible values are: %3$s.',
24 18
            $invalidValue,
25 18
            $key,
26 18
            implode(', ', $allowedValues)
27 18
        );
28 18
        parent::__construct($message, $code, $previous);
29 18
    }
30
}
31