Unique::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Storage package
5
 *
6
 * (c) Michal Wachowski <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Moss\Storage\Model\Definition\Index;
13
14
/**
15
 * Defines unique index for model
16
 *
17
 * @author  Michal Wachowski <[email protected]>
18
 * @package Moss\Storage
19
 */
20
class Unique extends Index
21
{
22
    protected $table;
23
    protected $name;
24
    protected $type;
25
    protected $fields = [];
26
27
    /**
28
     * Constructor
29
     *
30
     * @param string $name
31
     * @param array  $fields
32
     */
33
    public function __construct($name, array $fields)
34
    {
35
        $this->name = $name;
36
        $this->type = 'unique';
37
38
        $this->assertFields($fields);
39
40
        $this->fields = $fields;
41
    }
42
}
43