1 | <?php |
||
9 | class AirtableManager |
||
10 | { |
||
11 | /** |
||
12 | * The application instance. |
||
13 | * |
||
14 | * @var \Illuminate\Foundation\Application |
||
15 | */ |
||
16 | protected $app; |
||
17 | |||
18 | /** |
||
19 | * The active connection instances. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $tables = []; |
||
24 | |||
25 | /** |
||
26 | * Create a new Airtable manager instance. |
||
27 | * |
||
28 | * @param \Illuminate\Foundation\Application $app |
||
29 | * @return void |
||
|
|||
30 | */ |
||
31 | public function __construct($app) |
||
35 | |||
36 | /** |
||
37 | * Get a airtable table instance. |
||
38 | * |
||
39 | * @param string $name |
||
40 | * @return \Airtable\Table |
||
41 | */ |
||
42 | public function table($name = null) |
||
48 | |||
49 | /** |
||
50 | * Get the configuration for a table. |
||
51 | * |
||
52 | * @param string $name |
||
53 | * @return array |
||
54 | * |
||
55 | * @throws \InvalidArgumentException |
||
56 | */ |
||
57 | protected function configuration($name) |
||
72 | |||
73 | /** |
||
74 | * Get the default connection name. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getDefaultTable() |
||
82 | |||
83 | /** |
||
84 | * Set the default connection name. |
||
85 | * |
||
86 | * @param string $name |
||
87 | * @return void |
||
88 | */ |
||
89 | public function setDefaultTable($name) |
||
93 | |||
94 | /** |
||
95 | * Return all of the created connections. |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | public function getTables() |
||
103 | |||
104 | /** |
||
105 | * Set the given table instance. |
||
106 | * |
||
107 | * @param string $name |
||
108 | * @param mixed $table |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function set($name, $table) |
||
117 | |||
118 | /** |
||
119 | * Attempt to get the table from the local cache. |
||
120 | * |
||
121 | * @param string $name |
||
122 | * @return \Tapp\Airtable |
||
123 | */ |
||
124 | protected function get($name) |
||
128 | |||
129 | /** |
||
130 | * Resolve the given table. |
||
131 | * |
||
132 | * @param string $name |
||
133 | * @return Airtable |
||
134 | * |
||
135 | * @throws \InvalidArgumentException |
||
136 | */ |
||
137 | protected function resolve($name) |
||
147 | |||
148 | protected function createAirtable($config) |
||
157 | |||
158 | /** |
||
159 | * Get the table configuration. |
||
160 | * |
||
161 | * @param string $name |
||
162 | * @return array |
||
163 | */ |
||
164 | protected function getConfig($name) |
||
168 | |||
169 | /** |
||
170 | * Dynamically pass methods to the default connection. |
||
171 | * |
||
172 | * @param string $method |
||
173 | * @param array $parameters |
||
174 | * @return mixed |
||
175 | */ |
||
176 | public function __call($method, $parameters) |
||
180 | } |
||
181 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.