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

References   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A references() 0 9 1
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
}