Passed
Pull Request — 3.x (#31)
by
unknown
14:21
created

Index::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
4
declare(strict_types=1);
5
6
namespace Cycle\Migrations\V2;
7
8
class Index
9
{
10
    protected array $fields;
11
    protected ?string $name;
12
    protected bool $unique = false;
13
14
    public function __construct(array $fields, ?string $name = null)
15
    {
16
        $this->fields = $fields;
17
        $this->name = $name;
18
    }
19
20
    public function unique(): self
21
    {
22
        $this->unique = true;
23
24
        return $this;
25
    }
26
27
    public function notUnique(): self
28
    {
29
        $this->unique = false;
30
31
        return $this;
32
    }
33
}
34