UnknownPropertiesDtoException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Larapie\DataTransferObject\Exceptions;
4
5
use RuntimeException;
6
7
class UnknownPropertiesDtoException extends RuntimeException
8
{
9 3
    public function __construct(array $properties, string $className)
10
    {
11 3
        $propertyNames = implode(', ', array_keys($properties));
12 3
        if (count($properties) > 1) {
13 1
            $message = "Parameters {$propertyNames} are not allowed as input on {$className}";
14
        } else {
15 2
            $message = "Parameter {$propertyNames} is not allowed as input on {$className}";
16
        }
17 3
        parent::__construct($message);
18 3
    }
19
}
20