@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | ini_set('display_errors', 0); |
6 | 6 | |
7 | 7 | |
8 | -require_once __DIR__ . '/vendor/autoload.php'; |
|
8 | +require_once __DIR__.'/vendor/autoload.php'; |
|
9 | 9 | |
10 | 10 | $container = new Pimple\Container(); |
11 | 11 | |
12 | 12 | |
13 | 13 | // load the config for the application |
14 | -$config_path = __DIR__ . '/config.json'; |
|
14 | +$config_path = __DIR__.'/config.json'; |
|
15 | 15 | |
16 | 16 | $handle = @fopen($config_path, 'r'); |
17 | 17 | if ($handle === false) { |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | |
30 | 30 | // timezones are fun |
31 | 31 | date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration |
32 | -$container['default_timezone'] = function ($c) { |
|
32 | +$container['default_timezone'] = function($c) { |
|
33 | 33 | return new DateTimeZone('America/Phoenix'); |
34 | 34 | }; |
35 | 35 | |
36 | 36 | |
37 | 37 | // configure the db connections holder |
38 | 38 | $db_connections = new Aura\Sql\ConnectionLocator(); |
39 | -$db_connections->setDefault(function () use ($config) { |
|
39 | +$db_connections->setDefault(function() use ($config) { |
|
40 | 40 | $connection = $config->database->slave; |
41 | 41 | return new Aura\Sql\ExtendedPdo( |
42 | 42 | "mysql:host={$connection->host}", |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $connection->password |
45 | 45 | ); |
46 | 46 | }); |
47 | -$db_connections->setWrite('master', function () use ($config) { |
|
47 | +$db_connections->setWrite('master', function() use ($config) { |
|
48 | 48 | $connection = $config->database->master; |
49 | 49 | return new Aura\Sql\ExtendedPdo( |
50 | 50 | "mysql:host={$connection->host}", |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $connection->password |
53 | 53 | ); |
54 | 54 | }); |
55 | -$db_connections->setRead('slave', function () use ($config) { |
|
55 | +$db_connections->setRead('slave', function() use ($config) { |
|
56 | 56 | $connection = $config->database->slave; |
57 | 57 | $pdo = new Aura\Sql\ExtendedPdo( |
58 | 58 | "mysql:host={$connection->host}", |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | |
72 | 72 | // configure the comment service connection |
73 | -$container['comment_service_api'] = function () use ($config) { |
|
73 | +$container['comment_service_api'] = function() use ($config) { |
|
74 | 74 | $configuration = (new Jacobemerick\CommentService\Configuration()) |
75 | 75 | ->setUsername($config->comments->user) |
76 | 76 | ->setPassword($config->comments->password) |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | // setup mail handler |
87 | -$container['mail'] = $container->factory(function ($c) { |
|
87 | +$container['mail'] = $container->factory(function($c) { |
|
88 | 88 | return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']); |
89 | 89 | }); |
90 | 90 | |
91 | 91 | |
92 | 92 | // setup the logger |
93 | -$container['setup_logger'] = $container->protect(function ($name) use ($container) { |
|
93 | +$container['setup_logger'] = $container->protect(function($name) use ($container) { |
|
94 | 94 | $logger = new Monolog\Logger($name); |
95 | 95 | |
96 | - $logPath = __DIR__ . "/logs/{$name}.log"; |
|
96 | + $logPath = __DIR__."/logs/{$name}.log"; |
|
97 | 97 | $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO); |
98 | 98 | $streamHandler->setFormatter( |
99 | 99 | new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n") |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | // sets up shutdown function to display profiler |
124 | -register_shutdown_function(function () use ($container) { |
|
124 | +register_shutdown_function(function() use ($container) { |
|
125 | 125 | if ( |
126 | 126 | !isset($_COOKIE['debugger']) || |
127 | 127 | $_COOKIE['debugger'] != 'display' |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | ->getRead() |
134 | 134 | ->getProfiler() |
135 | 135 | ->getProfiles(); |
136 | - $dbProfiles = array_filter($dbProfiles, function ($profile) { |
|
136 | + $dbProfiles = array_filter($dbProfiles, function($profile) { |
|
137 | 137 | return $profile['function'] == 'perform'; |
138 | 138 | }); |
139 | - $dbProfiles = array_map(function ($profile) { |
|
139 | + $dbProfiles = array_map(function($profile) { |
|
140 | 140 | return [ |
141 | 141 | 'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])), |
142 | 142 | 'parameters' => $profile['bind_values'], |