1 | <?php |
||
16 | class Describe |
||
17 | { |
||
18 | /** |
||
19 | * @var \Rougin\Describe\Driver\DriverInterface |
||
20 | */ |
||
21 | protected $driver; |
||
22 | |||
23 | /** |
||
24 | * @param \Rougin\Describe\Driver\DriverInterface $driver |
||
25 | */ |
||
26 | 159 | public function __construct(Driver\DriverInterface $driver) |
|
27 | { |
||
28 | 159 | $this->driver = $driver; |
|
29 | 159 | } |
|
30 | |||
31 | /** |
||
32 | * Returns an array of Column instances from a table. |
||
33 | * |
||
34 | * @param string $table |
||
35 | * @return \Rougin\Describe\Column[] |
||
36 | */ |
||
37 | 24 | public function columns($table) |
|
38 | { |
||
39 | 24 | return $this->driver->columns($table); |
|
40 | } |
||
41 | |||
42 | /** |
||
43 | * Returns an array of Column instances from a table. |
||
44 | * NOTE: To be removed in v2.0.0. Use columns() instead. |
||
45 | * |
||
46 | * @param string $table |
||
47 | * @return \Rougin\Describe\Column[] |
||
48 | */ |
||
49 | 24 | public function getColumns($table) |
|
50 | { |
||
51 | 24 | return $this->driver->getColumns($table); |
|
52 | } |
||
53 | |||
54 | /** |
||
55 | * Returns the primary key of a table. |
||
56 | * NOTE: To be removed in v2.0.0. Use primary() instead. |
||
57 | * |
||
58 | * @param string $table |
||
59 | * @param boolean $object |
||
60 | * @return \Rougin\Describe\Column|string |
||
61 | */ |
||
62 | 12 | public function getPrimaryKey($table, $object = false) |
|
63 | { |
||
64 | 12 | return $this->primary($table, $object); |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Returns an array of columns from a table. |
||
69 | * NOTE: To be removed in v2.0.0. Use getColumns() instead. |
||
70 | * |
||
71 | * @param string $table |
||
72 | * @return array |
||
73 | */ |
||
74 | 51 | public function getTable($table) |
|
75 | { |
||
76 | 51 | return $this->driver->getTable($table); |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * Returns an array of table names. |
||
81 | * NOTE: To be removed in v2.0.0. Use tables() instead. |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | 12 | public function getTableNames() |
|
89 | |||
90 | /** |
||
91 | * Returns the primary key of a table. |
||
92 | * |
||
93 | * @param string $table |
||
94 | * @param boolean $object |
||
95 | * @return \Rougin\Describe\Column|string |
||
96 | */ |
||
97 | 24 | public function primary($table, $object = false) |
|
105 | |||
106 | /** |
||
107 | * Returns an array of table names. |
||
108 | * NOTE: To be removed in v2.0.0. Use getTableNames() instead. |
||
109 | * |
||
110 | * @return array |
||
111 | */ |
||
112 | 12 | public function showTables() |
|
116 | |||
117 | /** |
||
118 | * Returns an array of Table instances. |
||
119 | * |
||
120 | * @return \Rougin\Describe\Table[] |
||
121 | */ |
||
122 | 12 | public function tables() |
|
126 | |||
127 | /** |
||
128 | * Calls methods from this class in underscore case. |
||
129 | * NOTE: To be removed in v2.0.0. All new methods are now in one word. |
||
130 | * |
||
131 | * @param string $method |
||
132 | * @param mixed $parameters |
||
133 | * @return mixed |
||
134 | */ |
||
135 | 12 | public function __call($method, $parameters) |
|
143 | } |
||
144 |