Completed
Pull Request — master (#1339)
by José
01:55
created

Table   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 70
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A setName() 0 6 1
A getName() 0 4 1
A getOptions() 0 4 1
A setOptions() 0 4 1
1
<?php
2
namespace Phinx\Db\Table;
3
4
use InvalidArgumentException;
5
6
class Table
7
{
8
    /**
9
     * @var string
10
     */
11
    protected $name;
12
13
    /**
14
     * @var array
15
     */
16
    protected $options;
17
18
    /**
19
     * @param string $name The table name
20
     * @param array $options The creation options for this table
21
     */
22
    public function __construct($name, array $options = [])
23
    {
24
        if (empty($name)) {
25
            throw new InvalidArgumentException('Cannot use an empty table name');
26
        }
27
28
        $this->name = $name;
29
        $this->options = $options;
30
    }
31
32
    /**
33
     * Sets the table name.
34
     *
35
     * @param string $name The name of the table
36
     * @return \Phinx\Db\Table\Table
37
     */
38
    public function setName($name)
39
    {
40
        $this->name = $name;
41
42
        return $this;
43
    }
44
45
    /**
46
     * Gets the table name.
47
     *
48
     * @return string
49
     */
50
    public function getName()
51
    {
52
        return $this->name;
53
    }
54
55
    /**
56
     * Gets the table options
57
     *
58
     * @return array
59
     */
60
    public function getOptions()
61
    {
62
        return $this->options;
63
    }
64
65
    /**
66
     * Sets the table options
67
     *
68
     * @param array $options The options for the table creation
69
     * @return void
70
     */
71
    public function setOptions(array $options)
72
    {
73
        $this->options = $options;
74
    }
75
}
76