Completed
Push — master ( c623e8...f78604 )
by Pavel
05:18
created

CriteriaConfigurationException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 26
rs 10
ccs 0
cts 14
cp 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A unknown() 0 4 1
A invalid() 0 4 1
A invalidType() 0 6 1
A invalidCriteriaConfiguration() 0 6 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 self(sprintf('Unknown criteria configurators: %s', implode(', ', $names)));
10
    }
11
12
    public static function invalid($name, $value)
13
    {
14
        return new self(sprintf('Invalid data passed to criteria configurators "%s": %s', $name, json_encode($value)));
15
    }
16
17
    public static function invalidType($expected, $actual)
18
    {
19
        return new self(
20
            sprintf('Invalid data format passed to criteria configurator: %s expected, %s given', $expected, $actual)
21
        );
22
    }
23
24
    public static function invalidCriteriaConfiguration($field)
25
    {
26
        return new self(
27
            sprintf('Invalid data passed to criteria configurator: %s', $field)
28
        );
29
    }
30
}
31