Failed Conditions
Push — exceptions ( 64d080...7fc4df )
by Michael
15:07
created

ValueNotConvertible   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A new() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Types\Exception;
6
7
use Doctrine\DBAL\Types\ConversionException;
8
9
/**
10
 * Thrown when a Database to Doctrine Type Conversion fails.
11
 */
12
final class ValueNotConvertible extends ConversionException implements TypesException
13
{
14 210
    public static function new(string $value, string $toType) : self
15
    {
16 210
        return new self(
17 210
            sprintf(
18 210
                'Could not convert database value "%s" to Doctrine Type %s',
19 210
                strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value,
20 210
                $toType
21
            )
22
        );
23
    }
24
}
25