1 | <?php |
||
11 | class Connector |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * The default PDO connection options. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $options = [ |
||
20 | PDO::ATTR_CASE => PDO::CASE_NATURAL, |
||
21 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
||
22 | PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, |
||
23 | PDO::ATTR_STRINGIFY_FETCHES => false, |
||
24 | PDO::ATTR_EMULATE_PREPARES => false, |
||
25 | ]; |
||
26 | |||
27 | /** |
||
28 | * Create a new PDO connection. |
||
29 | * |
||
30 | * @param string $dsn |
||
31 | * @param array $config |
||
32 | * @param array $options |
||
33 | * @return \PDO |
||
34 | * |
||
35 | * @throws \Exception |
||
36 | */ |
||
37 | public function createConnection($dsn, array $config, array $options) |
||
54 | |||
55 | /** |
||
56 | * Create a new PDO connection instance. |
||
57 | * |
||
58 | * @param string $dsn |
||
59 | * @param string $username |
||
60 | * @param string $password |
||
61 | * @param array $options |
||
62 | * @return \PDO |
||
63 | */ |
||
64 | protected function createPdoConnection($dsn, $username, $password, $options) |
||
72 | |||
73 | /** |
||
74 | * Determine if the connection is persistent. |
||
75 | * |
||
76 | * @param array $options |
||
77 | * @return bool |
||
78 | */ |
||
79 | protected function isPersistentConnection($options) |
||
84 | |||
85 | /** |
||
86 | * Handle an exception that occurred during connect execution. |
||
87 | * |
||
88 | * @param \Throwable $e |
||
89 | * @param string $dsn |
||
90 | * @param string $username |
||
91 | * @param string $password |
||
92 | * @param array $options |
||
93 | * @return \PDO |
||
94 | * |
||
95 | * @throws \Exception |
||
96 | */ |
||
97 | protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options) |
||
105 | |||
106 | /** |
||
107 | * Get the PDO options based on the configuration. |
||
108 | * |
||
109 | * @param array $config |
||
110 | * @return array |
||
111 | */ |
||
112 | public function getOptions(array $config) |
||
118 | |||
119 | /** |
||
120 | * Get the default PDO connection options. |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | public function getDefaultOptions() |
||
128 | |||
129 | /** |
||
130 | * Set the default PDO connection options. |
||
131 | * |
||
132 | * @param array $options |
||
133 | * @return void |
||
134 | */ |
||
135 | public function setDefaultOptions(array $options) |
||
139 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.