1: <?php namespace Laravel\Database\Connectors; use PDO;
2:
3: abstract class Connector {
4:
5: /**
6: * The PDO connection options.
7: *
8: * @var array
9: */
10: protected $options = array(
11: PDO::ATTR_CASE => PDO::CASE_LOWER,
12: PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
13: PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
14: PDO::ATTR_STRINGIFY_FETCHES => false,
15: PDO::ATTR_EMULATE_PREPARES => false,
16: );
17:
18: /**
19: * Establish a PDO database connection.
20: *
21: * @param array $config
22: * @return PDO
23: */
24: abstract public function connect($config);
25:
26: /**
27: * Get the PDO connection options for the configuration.
28: *
29: * Developer specified options will override the default connection options.
30: *
31: * @param array $config
32: * @return array
33: */
34: protected function options($config)
35: {
36: $options = (isset($config['options'])) ? $config['options'] : array();
37:
38: return $options + $this->options;
39: }
40:
41: }