@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $handle = @fopen($config_path, 'r'); |
9 | 9 | if ($handle === false) { |
10 | - throw new RuntimeException("Could not load config"); |
|
10 | + throw new RuntimeException("Could not load config"); |
|
11 | 11 | } |
12 | 12 | $config = fread($handle, filesize($config_path)); |
13 | 13 | fclose($handle); |
@@ -15,40 +15,40 @@ discard block |
||
15 | 15 | $config = json_decode($config); |
16 | 16 | $last_json_error = json_last_error(); |
17 | 17 | if ($last_json_error !== JSON_ERROR_NONE) { |
18 | - throw new RuntimeException("Could not parse config - JSON error detected"); |
|
18 | + throw new RuntimeException("Could not parse config - JSON error detected"); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | // configure the db connections holder |
22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
23 | 23 | $db_connections->setDefault(function () use ($config) { |
24 | - $connection = $config->database->slave; |
|
25 | - return new Aura\Sql\ExtendedPdo( |
|
26 | - "mysql:host={$connection->host}", |
|
27 | - $connection->user, |
|
28 | - $connection->password |
|
29 | - ); |
|
24 | + $connection = $config->database->slave; |
|
25 | + return new Aura\Sql\ExtendedPdo( |
|
26 | + "mysql:host={$connection->host}", |
|
27 | + $connection->user, |
|
28 | + $connection->password |
|
29 | + ); |
|
30 | 30 | }); |
31 | 31 | $db_connections->setWrite('master', function () use ($config) { |
32 | - $connection = $config->database->master; |
|
33 | - return new Aura\Sql\ExtendedPdo( |
|
34 | - "mysql:host={$connection->host}", |
|
35 | - $connection->user, |
|
36 | - $connection->password |
|
37 | - ); |
|
32 | + $connection = $config->database->master; |
|
33 | + return new Aura\Sql\ExtendedPdo( |
|
34 | + "mysql:host={$connection->host}", |
|
35 | + $connection->user, |
|
36 | + $connection->password |
|
37 | + ); |
|
38 | 38 | }); |
39 | 39 | $db_connections->setRead('slave', function () use ($config) { |
40 | - $connection = $config->database->slave; |
|
41 | - $pdo = new Aura\Sql\ExtendedPdo( |
|
42 | - "mysql:host={$connection->host}", |
|
43 | - $connection->user, |
|
44 | - $connection->password |
|
45 | - ); |
|
46 | - |
|
47 | - $profiler = new Aura\Sql\Profiler(); |
|
48 | - $profiler->setActive(true); |
|
49 | - $pdo->setProfiler($profiler); |
|
50 | - |
|
51 | - return $pdo; |
|
40 | + $connection = $config->database->slave; |
|
41 | + $pdo = new Aura\Sql\ExtendedPdo( |
|
42 | + "mysql:host={$connection->host}", |
|
43 | + $connection->user, |
|
44 | + $connection->password |
|
45 | + ); |
|
46 | + |
|
47 | + $profiler = new Aura\Sql\Profiler(); |
|
48 | + $profiler->setActive(true); |
|
49 | + $pdo->setProfiler($profiler); |
|
50 | + |
|
51 | + return $pdo; |
|
52 | 52 | }); |
53 | 53 | |
54 | 54 | // setup the service locator |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | // configure the db connections holder |
22 | 22 | $db_connections = new Aura\Sql\ConnectionLocator(); |
23 | -$db_connections->setDefault(function () use ($config) { |
|
23 | +$db_connections->setDefault(function() use ($config) { |
|
24 | 24 | $connection = $config->database->slave; |
25 | 25 | return new Aura\Sql\ExtendedPdo( |
26 | 26 | "mysql:host={$connection->host}", |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $connection->password |
29 | 29 | ); |
30 | 30 | }); |
31 | -$db_connections->setWrite('master', function () use ($config) { |
|
31 | +$db_connections->setWrite('master', function() use ($config) { |
|
32 | 32 | $connection = $config->database->master; |
33 | 33 | return new Aura\Sql\ExtendedPdo( |
34 | 34 | "mysql:host={$connection->host}", |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $connection->password |
37 | 37 | ); |
38 | 38 | }); |
39 | -$db_connections->setRead('slave', function () use ($config) { |
|
39 | +$db_connections->setRead('slave', function() use ($config) { |
|
40 | 40 | $connection = $config->database->slave; |
41 | 41 | $pdo = new Aura\Sql\ExtendedPdo( |
42 | 42 | "mysql:host={$connection->host}", |