@@ -6,10 +6,8 @@ |
||
6 | 6 | require_once __DIR__ . '/../vendor/autoload.php'; |
7 | 7 | |
8 | 8 | use Silex\Application; |
9 | -use Symfony\Component\HttpFoundation\Request; |
|
10 | 9 | use Symfony\Component\HttpFoundation\Response; |
11 | 10 | use Silex\Provider\UrlGeneratorServiceProvider; |
12 | -use Silex\Provider\SessionServiceProvider; |
|
13 | 11 | use Silex\Provider\ServiceControllerServiceProvider; |
14 | 12 | use Silex\Provider\MonologServiceProvider; |
15 | 13 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Register Monolog service provider for local logging |
43 | 43 | $app->register(new MonologServiceProvider(), array( |
44 | - 'monolog.logfile' => __DIR__.LOG_PATH, |
|
44 | + 'monolog.logfile' => __DIR__.LOG_PATH, |
|
45 | 45 | 'monolog.name' => APP_NAME, |
46 | 46 | 'monolog.level' => LOG_LEVEL |
47 | 47 | )); |
@@ -65,5 +65,5 @@ discard block |
||
65 | 65 | |
66 | 66 | // Load routes |
67 | 67 | foreach(glob(__DIR__ . "/src/Kineo/Route/*.php") as $filename) { |
68 | - require_once $filename; |
|
68 | + require_once $filename; |
|
69 | 69 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | // Set character encoding |
28 | 28 | $app['charset'] = 'UTF-8'; |
29 | 29 | |
30 | -if(DEBUG) { |
|
30 | +if (DEBUG) { |
|
31 | 31 | error_reporting(E_ALL); |
32 | 32 | ini_set('display_errors', 1); |
33 | 33 | $app['debug'] = true; |
@@ -41,16 +41,16 @@ discard block |
||
41 | 41 | |
42 | 42 | // Register Monolog service provider for local logging |
43 | 43 | $app->register(new MonologServiceProvider(), array( |
44 | - 'monolog.logfile' => __DIR__.LOG_PATH, |
|
44 | + 'monolog.logfile' => __DIR__ . LOG_PATH, |
|
45 | 45 | 'monolog.name' => APP_NAME, |
46 | 46 | 'monolog.level' => LOG_LEVEL |
47 | 47 | )); |
48 | 48 | |
49 | 49 | // Error handler |
50 | 50 | $app->error(function(\Exception $e, $code) use ($app) { |
51 | - if($app['debug']) return; |
|
51 | + if ($app['debug']) return; |
|
52 | 52 | |
53 | - switch($code) { |
|
53 | + switch ($code) { |
|
54 | 54 | case 404: |
55 | 55 | return $app->redirect('/'); |
56 | 56 | break; |
@@ -64,6 +64,6 @@ discard block |
||
64 | 64 | }); |
65 | 65 | |
66 | 66 | // Load routes |
67 | -foreach(glob(__DIR__ . "/src/Kineo/Route/*.php") as $filename) { |
|
67 | +foreach (glob(__DIR__ . "/src/Kineo/Route/*.php") as $filename) { |
|
68 | 68 | require_once $filename; |
69 | 69 | } |
@@ -48,7 +48,9 @@ |
||
48 | 48 | |
49 | 49 | // Error handler |
50 | 50 | $app->error(function(\Exception $e, $code) use ($app) { |
51 | - if($app['debug']) return; |
|
51 | + if($app['debug']) { |
|
52 | + return; |
|
53 | + } |
|
52 | 54 | |
53 | 55 | switch($code) { |
54 | 56 | case 404: |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | -use Silex\Application; |
|
3 | 2 | use Kineo\Controller\DataController; |
4 | 3 | |
5 | 4 | $app['data.controller'] = $app->share(function() use ($app) { |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | -use Silex\Application; |
|
3 | 2 | use Kineo\Controller\IndexController; |
4 | 3 | |
5 | 4 | $app['index.controller'] = $app->share(function() use ($app) { |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | -use Silex\Application; |
|
3 | 2 | use Kineo\Controller\ResultsController; |
4 | 3 | |
5 | 4 | $app['results.controller'] = $app->share(function() use ($app) { |
@@ -1,5 +1,4 @@ |
||
1 | 1 | <?php |
2 | -use Silex\Application; |
|
3 | 2 | use Kineo\Controller\VoteController; |
4 | 3 | |
5 | 4 | $app['vote.controller'] = $app->share(function() use ($app) { |
@@ -5,10 +5,10 @@ |
||
5 | 5 | |
6 | 6 | class WebTestCase extends BaseWebTestCase |
7 | 7 | { |
8 | - public function createApplication() |
|
9 | - { |
|
10 | - $app = require $_SERVER['APP_DIR'] . '/src/app.php'; |
|
8 | + public function createApplication() |
|
9 | + { |
|
10 | + $app = require $_SERVER['APP_DIR'] . '/src/app.php'; |
|
11 | 11 | |
12 | - return $app; |
|
13 | - } |
|
12 | + return $app; |
|
13 | + } |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | $bindArray = array('param' => 4); |
19 | 19 | |
20 | - Database::bindParamArray('test', array(4,6,8), $bindArray); |
|
20 | + Database::bindParamArray('test', array(4, 6, 8), $bindArray); |
|
21 | 21 | |
22 | 22 | $expected = array( |
23 | 23 | 'param' => 4, |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // Import application config |
3 | -switch(getenv('env')) { |
|
3 | +switch (getenv('env')) { |
|
4 | 4 | case 'test': |
5 | 5 | $configFile = 'config-test.ini'; |
6 | 6 | break; |
@@ -16,6 +16,6 @@ discard block |
||
16 | 16 | |
17 | 17 | $iniArray = parse_ini_file(__DIR__ . DIRECTORY_SEPARATOR . $configFile); |
18 | 18 | |
19 | -foreach($iniArray as $key => $val) { |
|
19 | +foreach ($iniArray as $key => $val) { |
|
20 | 20 | define($key, $val); |
21 | 21 | } |
22 | 22 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $constituenciesModel = new ConstituenciesModel(new Database()); |
24 | 24 | |
25 | - if($constituenciesModel->getAllConstituencies()) { |
|
25 | + if ($constituenciesModel->getAllConstituencies()) { |
|
26 | 26 | return json_encode($constituenciesModel->constituencies); |
27 | 27 | } else { |
28 | 28 | return ApiResponse::error('NO_CONSTITUENCIES_FOUND'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $candidatesModel = new CandidatesModel(new Database()); |
35 | 35 | |
36 | - if($candidatesModel->getCandidatesByConstituencyId($constituencyId)) { |
|
36 | + if ($candidatesModel->getCandidatesByConstituencyId($constituencyId)) { |
|
37 | 37 | return json_encode($candidatesModel->candidates); |
38 | 38 | } else { |
39 | 39 | return ApiResponse::error('NO_CANDIDATES_FOUND'); |