Index::addKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
namespace yentu\database;
3
4
5
class Index extends BasicKey
6
{
7
    protected $unique = false;
8
9
    public function unique($unique = true)
10
    {
11
        $this->unique = $unique;
12
        return $this;
13
    }
14
15
    #[\Override]
16
    protected function doesKeyExist($constraint)
17
    {
18
        return $this->getChangeLogger()->doesIndexExist($constraint);
0 ignored issues
show
Bug introduced by
The method doesIndexExist() does not exist on yentu\ChangeLogger. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        return $this->getChangeLogger()->/** @scrutinizer ignore-call */ doesIndexExist($constraint);
Loading history...
19
    }
20
21
    #[\Override]
22
    protected function addKey($constraint)
23
    {
24
        $this->getChangeLogger()->addIndex($constraint);
0 ignored issues
show
Bug introduced by
The method addIndex() does not exist on yentu\ChangeLogger. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ addIndex($constraint);
Loading history...
25
    }
26
27
    #[\Override]
28
    protected function dropKey($constraint)
29
    {
30
        $this->getChangeLogger()->dropIndex($constraint);
0 ignored issues
show
Bug introduced by
The method dropIndex() does not exist on yentu\ChangeLogger. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ dropIndex($constraint);
Loading history...
31
    }
32
33
    #[\Override]
34
    protected function getNamePostfix()
35
    {
36
        return 'idx';
37
    }
38
39
    #[\Override]
40
    public function buildDescription()
41
    {
42
        return parent::buildDescription() + ['unique' => $this->unique];
43
    }
44
}
45