InvalidParam::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 4
1
<?php
2
3
namespace Mfonte\Base62x\Exception;
4
5
class InvalidParam extends \InvalidArgumentException
6
{
7
    public const REASON = 'Invalid param "#PARAM#" passed in method "#METHOD#" on class "#CLASS#" ';
8
    public const CODE = 0;
9
10
    public function __construct($param, $method, $class, $detailedReason = null)
11
    {
12
        $reason = str_replace(['#PARAM#', '#METHOD#', '#CLASS#'], [$param, $method, $class], static::REASON);
13
        if ($detailedReason) {
14
            $reason .= ': '.$detailedReason;
15
        }
16
        parent::__construct($reason, static::CODE);
17
    }
18
}
19