Total Complexity | 7 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | class Table |
||
16 | { |
||
17 | /** |
||
18 | * @var \Rougin\Describe\Driver\DriverInterface |
||
19 | */ |
||
20 | protected $driver; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $name; |
||
26 | |||
27 | /** |
||
28 | * Initializes the table instance. |
||
29 | * |
||
30 | * @param string $name |
||
31 | * @param \Rougin\Describe\Driver\DriverInterface $driver |
||
32 | */ |
||
33 | 60 | public function __construct($name, DriverInterface $driver) |
|
38 | 60 | } |
|
39 | |||
40 | /** |
||
41 | * Returns an array of Column instances. |
||
42 | * |
||
43 | * @return \Rougin\Describe\Column[] |
||
44 | */ |
||
45 | 27 | public function columns() |
|
46 | { |
||
47 | 27 | return $this->driver->columns($this->name); |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Returns the name of the table. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 3 | public function name() |
|
56 | { |
||
57 | 3 | return $this->name; |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * Returns the primary key of a table. |
||
62 | * |
||
63 | * @return \Rougin\Describe\Column|null |
||
64 | */ |
||
65 | 24 | public function primary() |
|
74 | } |
||
75 | } |
||
76 |