Completed
Pull Request — develop (#3348)
by Sergei
65:02
created

NamedIndexRequired   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A new() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Schema\Exception;
6
7
use Doctrine\DBAL\Schema\Index;
8
use Doctrine\DBAL\Schema\SchemaException;
9
use Doctrine\DBAL\Schema\Table;
10
use function implode;
11
use function sprintf;
12
13
final class NamedIndexRequired extends SchemaException
14
{
15
    public static function new(Table $table, Index $index) : self
16
    {
17
        return new self(
18
            sprintf(
19
                'The performed schema operation on %s requires a named index, but the given index on (%s) is currently unnamed.',
20
                $table->getName(),
21
                implode(', ', $index->getColumns())
22
            )
23
        );
24
    }
25
}
26