1 | <?php |
||
10 | class PotatoConnector |
||
11 | { |
||
12 | /** |
||
13 | * [$connection PDO connection to be used to communicate with the database]. |
||
14 | * |
||
15 | * @var [type] PDO Connection |
||
16 | */ |
||
17 | public $connection; |
||
18 | |||
19 | /** |
||
20 | * [$configuration The configuration data to be used to establish the connection]. |
||
21 | * |
||
22 | * @var [type] |
||
23 | */ |
||
24 | public $configuration; |
||
25 | |||
26 | /** |
||
27 | * [__construct Set up the connection with the configuration data that is provided on instantiation of the class.]. |
||
28 | * |
||
29 | * @param array|null $configData [description] |
||
30 | */ |
||
31 | public function __construct(array $configData = null) |
||
37 | |||
38 | /** |
||
39 | * [setConnection Set up the connection with the configuration information]. |
||
40 | */ |
||
41 | public function setConnection() |
||
48 | |||
49 | /** |
||
50 | * [connect Try setting up the connection wtith given connection parameters]. |
||
51 | * |
||
52 | * @param [string] $adaptar [The adapter to be used witht he connection to the database] |
||
|
|||
53 | * @param [string] $host [The host name for the connection] |
||
54 | * @param [string] $dbname [The name of the database] |
||
55 | * @param [string] $username [The username to be used if it is required] |
||
56 | * @param [string] $password [The [assword to be used for the connectionif required.]] |
||
57 | * |
||
58 | * @return [type] [A PDO connection to the databsase] |
||
59 | */ |
||
60 | public function connect($adaptar) |
||
71 | |||
72 | /** |
||
73 | * [connectDriver Check which driver is chosen and create a PDO connection based on the driver information.] |
||
74 | * Throw an InvalidAdaptarException if the given driver is invalid, does not exist or is not compatible with PDO. |
||
75 | * |
||
76 | * @param [string] $adaptar [The adaptar/driver name used to create PDO connection.] |
||
77 | * @param [string] $host [The hostname to be used for the PDO connection if mysql is chosen.] |
||
78 | * @param [string] $dbname [The name of the database of the PDO connection.] |
||
79 | * @param [string] $username [The username to be used for the PDO connection if mysql is chosen.] |
||
80 | * @param [string] $password [The password to be used for the PDO connection id mysql is chosen.] |
||
81 | * |
||
82 | * @return [type] [description] |
||
83 | */ |
||
84 | public function connectDriver($adaptar) |
||
104 | |||
105 | /** |
||
106 | * [mysqlConnect Create a MySQL PDO connection with the mysql driver.]. |
||
107 | * |
||
108 | * @param [string] $adaptar [The adaptar name used to create PDO connection.] |
||
109 | * @param [string] $host [The hostname to be used for the PDO connection.] |
||
110 | * @param [string] $dbname [The name of the database of the PDO connection.] |
||
111 | * @param [string] $username [The username to be used for the PDO connection.] |
||
112 | * @param [string] $password [The password to be used for the PDO connection.] |
||
113 | * |
||
114 | * @return [type] A PDO connection done with a mysql driver |
||
115 | */ |
||
116 | public function mysqlConnect($adaptar, $host, $dbname, $username, $password) |
||
122 | |||
123 | /** |
||
124 | * [sqliteConnect Create an SQLite connection if the selected PDO drver is sqlite.]. |
||
125 | * |
||
126 | * @param [string] $adaptar The sqlite driver name |
||
127 | * @param [type] $dbFile [The database file. If this is null, then get the database file using the getSqliteFile method.] |
||
128 | * |
||
129 | * @return [type] A PDO connection done with am sqlite driver. |
||
130 | */ |
||
131 | public function sqliteConnect($adaptar, $dbFile = null) |
||
138 | |||
139 | /** |
||
140 | * [getSqliteFile Get the file location of the slqlite file if it is preferred to use an sqlite pdo connection.]. |
||
141 | * |
||
142 | * @param [type] $path [The path to the sqlite database file.] |
||
143 | * |
||
144 | * @return [type] [The path to the sqlite file if provided or a default file path if the path in the provided argument is null.] |
||
145 | */ |
||
146 | public function getSqliteFile() |
||
152 | |||
153 | /** |
||
154 | * [getConfigurations Get the configuration data from the file path]. |
||
155 | * |
||
156 | * @param [type] $filepath [The file path where the connection configuration information are located.] |
||
157 | * |
||
158 | * @return [array] [An array of the configuration information after parsing the information.] |
||
159 | */ |
||
160 | public function getConfigurations($filepath = null) |
||
166 | |||
167 | /** |
||
168 | * [getConfigFilePath Get the file path of the file where the configuration lies.]. |
||
169 | * |
||
170 | * @return [string] [The file path of the location where the confuiguration information lie.] |
||
171 | */ |
||
172 | public function getConfigFilePath($path = null) |
||
176 | |||
177 | /** |
||
178 | * [getAdaptar Get the name of the adapter to be used for the connection.]. |
||
179 | * |
||
180 | * @return [string] [The name of the adapter.] |
||
181 | */ |
||
182 | public function getAdaptar() |
||
186 | |||
187 | /** |
||
188 | * [getHost Get the name of the host to be used for the connection.]. |
||
189 | * |
||
190 | * @return [string] [The name of the host.] |
||
191 | */ |
||
192 | public function getHost() |
||
196 | |||
197 | /** |
||
198 | * [getDBName Get the name of the database where information/data will eb stored.]. |
||
199 | * |
||
200 | * @return [string] [The name of the database.] |
||
201 | */ |
||
202 | public function getDBName() |
||
206 | |||
207 | /** |
||
208 | * [getUsername Get the username for the connection to the database.]. |
||
209 | * |
||
210 | * @return [string] [The username for the connection to the database.] |
||
211 | */ |
||
212 | public function getUsername() |
||
216 | |||
217 | /** |
||
218 | * [getPassword Get the password of the user of the connection.]. |
||
219 | * |
||
220 | * @return [string] [The passwird of the user.] |
||
221 | */ |
||
222 | public function getPassword() |
||
226 | |||
227 | /** |
||
228 | * [throwFaultyConnectionException Throw an exception if along the lime the connection is not setup correctly]. |
||
229 | * |
||
230 | * @param [string] $message [The message to be related in event of this exception.] |
||
231 | * |
||
232 | * @return [type] [An inherited PDO exception with a customized message.] |
||
233 | */ |
||
234 | public function throwFaultyConnectionException($message) |
||
238 | |||
239 | /** |
||
240 | * [throwInvalidAdapterException Throw an exception if the adapter or driver is invalid, does not exist or is not supported by PDO. |
||
241 | * |
||
242 | * @param [string] $adaptar [The adaptar that should be used for the PDO connection.] |
||
243 | * |
||
244 | * @return [type] [An inherited PDO exception with a customized message.] |
||
245 | */ |
||
246 | public function throwInvalidAdapterException($adaptar) |
||
251 | } |
||
252 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.