Completed
Push — master ( 47d74e...c96bfe )
by Tom
02:53
created
application/bootstrap.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -6,10 +6,8 @@
 block discarded – undo
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
 	
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Require config loader
3
-require_once __DIR__ . '/config-loader.php';
3
+require_once __DIR__.'/config-loader.php';
4 4
 
5 5
 // Composer autoloader
6
-require_once __DIR__ . '/../vendor/autoload.php';
6
+require_once __DIR__.'/../vendor/autoload.php';
7 7
 	
8 8
 use Silex\Application;
9 9
 use Symfony\Component\HttpFoundation\Request;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
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;
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
application/src/Kineo/Route/vote.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,4 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
application/tests/Kineo/Component/DatabaseTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
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,
Please login to merge, or discard this patch.
application/src/Kineo/Controller/DataController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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');	
Please login to merge, or discard this patch.
application/src/Kineo/Controller/VoteController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		
24 24
 		$userModel = new UserModel(new Database());
25 25
 		
26
-		if($userModel->loadUserByEmail($userData->email)) {
26
+		if ($userModel->loadUserByEmail($userData->email)) {
27 27
 			return ApiResponse::error('USER_EXISTS');
28 28
 		}
29 29
 		
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			$userModel->saveUser($userData->email, $userData->first_name, $userData->surname, $userData->constituency, $userData->voting, $userData->candidate);
32 32
 			
33 33
 			return ApiResponse::success('DEFAULT_RESPONSE_SUCCESS');
34
-		} catch(\Exception $e) {
34
+		} catch (\Exception $e) {
35 35
 			return ApiResponse::error('USER_SAVE_FAIL');
36 36
 		}		
37 37
 	}
Please login to merge, or discard this patch.
application/src/Kineo/Controller/ResultsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 	{		
22 22
 		$resultsModel = new ResultsModel(new Database());
23 23
 		
24
-		if($resultsModel->getResults()) {
24
+		if ($resultsModel->getResults()) {
25 25
 			return json_encode($resultsModel->results);
26 26
 		} else {
27 27
 			return json_encode(array());
Please login to merge, or discard this patch.
application/src/Kineo/Model/BaseModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@
 block discarded – undo
10 10
 {
11 11
 	public function hydrateObjects($collectionPropertyName, $modelType, $records)
12 12
 	{
13
-		if(empty($records)) {
13
+		if (empty($records)) {
14 14
 			throw new \Exception('No records found');
15 15
 		} else {
16
-			foreach($records as $item) {
16
+			foreach ($records as $item) {
17 17
 				// Requires a fully qualified namespace
18 18
 				$doc = new $modelType($this->app);
19 19
 				
20
-				foreach($item as $key => $val) {
20
+				foreach ($item as $key => $val) {
21 21
 					$doc->{$key} = $val;
22 22
 				}
23 23
 				
Please login to merge, or discard this patch.
application/src/Kineo/Model/ConstituenciesModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 		
23 23
 		$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
24 24
 		
25
-		if(is_array($result) && !empty($result)) {
25
+		if (is_array($result) && !empty($result)) {
26 26
 			$this->constituencies = $result;
27 27
 			
28 28
 			return $this->constituencies;
Please login to merge, or discard this patch.
application/src/Kineo/Component/ApiResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
 	private static function setResponseStatusCode($response, $code)
49 49
 	{
50
-		switch($code) {
50
+		switch ($code) {
51 51
 			case 'SESSION_CHECK':
52 52
 			case 'DEFAULT_RESPONSE_SUCCESS':
53 53
 				// 200 - Success
Please login to merge, or discard this patch.