Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
29 | public static function valueOutOfRange(Equatable $value): self |
||
30 | { |
||
31 | if (method_exists($value, 'toString')) { |
||
32 | 36 | $representation = $value->toString(); |
|
33 | } elseif (method_exists($value, '__toString')) { |
||
34 | 36 | $representation = (string) $value; |
|
35 | 3 | } else { |
|
36 | 36 | $representation = spl_object_hash($value); |
|
37 | 3 | } |
|
38 | 3 | ||
39 | 30 | return new self(sprintf('Collection does not contain the value %s(%s)', get_class($value), $representation)); |
|
40 | } |
||
41 | } |
||
42 |