CriteriaConfigurationException   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 18.18%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 29
ccs 2
cts 11
cp 0.1818
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A unknown() 0 4 1
A invalidType() 0 4 1
A invalidData() 0 4 1
A invalidPropertyType() 0 6 1
A invalidProperty() 0 4 1
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