CriteriaConfigurationException::invalidProperty()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
namespace ScayTrase\Api\Cruds\Exception;
4
5
class CriteriaConfigurationException extends \InvalidArgumentException implements CrudsExceptionInterface
6
{
7
    public static function unknown(array $names)
8
    {
9
        return new static(sprintf('Unknown criteria: %s', implode(', ', $names)));
10
    }
11
12 2
    public static function invalidType($expected, $actual)
13
    {
14 2
        return new static(sprintf('Invalid criteria: %s expected, %s given', $expected, $actual));
15
    }
16
17
    public static function invalidData($field)
18
    {
19
        return new static(sprintf('Invalid criteria: %s', $field));
20
    }
21
22
    public static function invalidPropertyType($property, $expected, $actual)
23
    {
24
        return new static(
25
            sprintf('Invalid criteria property "%s": %s expected, %s given', $property, $expected, $actual)
26
        );
27
    }
28
29
    public static function invalidProperty($property, \Exception $exception)
30
    {
31
        return new static(sprintf('Invalid criteria property "%s": %s', $property, $exception->getMessage()));
32
    }
33
}
34