Completed
Pull Request — develop (#3348)
by Sergei
63:43
created

NamedIndexRequired::new()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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