Conditions | 4 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
29 | 78 | public static function doesNotContainValue($value): self |
|
30 | { |
||
31 | 78 | if (!is_object($value)) { |
|
32 | 24 | return new self( |
|
33 | 24 | sprintf('Collection does not contain the value %s(%s)', gettype($value), var_export($value, true)) |
|
34 | ); |
||
35 | } |
||
36 | |||
37 | 54 | if (method_exists($value, 'toString')) { |
|
38 | 3 | $representation = var_export($value->toString(), true); |
|
39 | 51 | } elseif (method_exists($value, '__toString')) { |
|
40 | 3 | $representation = var_export((string) $value, true); |
|
41 | } else { |
||
42 | 48 | $representation = spl_object_hash($value); |
|
43 | } |
||
44 | |||
45 | 54 | return new self( |
|
46 | 54 | sprintf('Collection does not contain the value %s(%s)', get_class($value), $representation) |
|
47 | ); |
||
48 | } |
||
49 | |||
55 |