Test Setup Failed
Push — master ( d6fde7...1e848b )
by Php Easy Api
04:20
created

References::__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
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Migratio\GrammarStructure\Mysql\Wizard\Foreign;
4
5
use Migratio\Contract\Foreign\ReferencesContract;
6
7
class References implements ReferencesContract
8
{
9
    /**
10
     * @var $wizard WizardContract
0 ignored issues
show
Documentation Bug introduced by
The doc comment $wizard at position 0 could not be parsed: Unknown type name '$wizard' at position 0 in $wizard.
Loading history...
11
     */
12
    protected $wizard;
13
14
    /**
15
     * @var $constraint
0 ignored issues
show
Documentation Bug introduced by
The doc comment $constraint at position 0 could not be parsed: Unknown type name '$constraint' at position 0 in $constraint.
Loading history...
16
     */
17
    protected $constraint;
18
19
    /**
20
     * References constructor.
21
     * @param $wizard
22
     * @param $constraint
23
     */
24
    public function __construct($wizard,$constraint)
25
    {
26
        $this->wizard=$wizard;
27
        $this->constraint=$constraint;
28
    }
29
30
    /**
31
     * @param $table
32
     * @param string $field
33
     * @return \Migratio\Contract\Foreign\OptionsContract
34
     */
35
    public function references($table, $field = 'id')
36
    {
37
        $this->wizard->setReferences($this->constraint,'references',
38
            [
39
                'table'=>$table,
40
                'field'=>$field
41
            ]);
42
43
        return new Options($this->wizard,$this->constraint);
44
    }
45
}