Completed
Pull Request — master (#64)
by Christopher
08:34
created
api-classes/Database.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
             if ($first) {
181 181
                 $first = false;
182 182
                 $fields .= $item['field'];
183
-                $valuesPlaceholder .= ':'.$item['field'];
183
+                $valuesPlaceholder .= ':' . $item['field'];
184 184
             } else {
185
-                $fields .= ', '.$item['field'];
186
-                $valuesPlaceholder .= ', :'.$item['field'];
185
+                $fields .= ', ' . $item['field'];
186
+                $valuesPlaceholder .= ', :' . $item['field'];
187 187
             }
188 188
 
189 189
             if ($item['type'] == 's' || $item['type'] == 'string') {
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             }
202 202
         }
203 203
 
204
-        $statement = $this->db_connection->prepare('INSERT INTO '.$table.' ('.$fields.') VALUES ('.$valuesPlaceholder.')');
204
+        $statement = $this->db_connection->prepare('INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $valuesPlaceholder . ')');
205 205
         foreach ($data as $item) {
206
-            $statement->bindParam(':'.$item['field'], $item['value']);
206
+            $statement->bindParam(':' . $item['field'], $item['value']);
207 207
         }
208 208
 
209 209
         if ($statement->execute()) {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
     private function addPrefix($table)
250 250
     {
251
-        $table = $this->db_prefix.$table;
251
+        $table = $this->db_prefix . $table;
252 252
 
253 253
         return $table;
254 254
     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     public function count($table, $column, $where = null)
273 273
     {
274 274
         $columns = [
275
-      'COUNT('.$column.') AS count',
275
+      'COUNT(' . $column . ') AS count',
276 276
      ];
277 277
         $statement = $this->selectStatement($table, $columns, $where);
278 278
 
Please login to merge, or discard this patch.
api-classes/Event.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
         foreach ($rehersals as $rehersal) {
110 110
             if (!is_a($rehersal, 'Rehersal')) {
111
-                throw new Exception('Rehersal is not a Rehersal object: '.$rehersal, 1);
111
+                throw new Exception('Rehersal is not a Rehersal object: ' . $rehersal, 1);
112 112
             }
113 113
         }
114 114
         $this->rehersals = $rehersals;
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
     public function createInDb(Database $db)
118 118
     {
119 119
         if (empty($this->name) || empty($this->datetime) || empty($this->series) || empty($this->type) || empty($this->subType) || empty($this->location)) {
120
-            $message = 'Series name ('.$this->name.')';
121
-            $message .= ' or date ('.$this->datetime.')';
122
-            $message .= ' or series ('.$this->series.')';
123
-            $message .= ' or type ('.$this->type.')';
124
-            $message .= ' or sub_type ('.$this->subType.')';
125
-            $message .= ' or location ('.$this->location.')';
120
+            $message = 'Series name (' . $this->name . ')';
121
+            $message .= ' or date (' . $this->datetime . ')';
122
+            $message .= ' or series (' . $this->series . ')';
123
+            $message .= ' or type (' . $this->type . ')';
124
+            $message .= ' or sub_type (' . $this->subType . ')';
125
+            $message .= ' or location (' . $this->location . ')';
126 126
             $message .= ' cannot be empty.';
127 127
 
128 128
             throw new Exception($message);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     ];
181 181
 
182 182
         $where = [
183
-      'id = '.$id,
183
+      'id = ' . $id,
184 184
     ];
185 185
 
186 186
         $result = $db->selectSingle('Event', $this->db_table, $columns, $where);
Please login to merge, or discard this patch.
api-classes/Person.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
     public function createInDb(Database $db)
25 25
     {
26 26
         if (empty($this->name) || empty($this->datetime) || empty($this->series) || empty($this->type) || empty($this->sub_type) || empty($this->location)) {
27
-            $message = 'Series name ('.$this->name.')';
28
-            $message .= ' or date ('.$this->datetime.')';
29
-            $message .= ' or series ('.$this->series.')';
30
-            $message .= ' or type ('.$this->type.')';
31
-            $message .= ' or sub_type ('.$this->sub_type.')';
32
-            $message .= ' or location ('.$this->location.')';
27
+            $message = 'Series name (' . $this->name . ')';
28
+            $message .= ' or date (' . $this->datetime . ')';
29
+            $message .= ' or series (' . $this->series . ')';
30
+            $message .= ' or type (' . $this->type . ')';
31
+            $message .= ' or sub_type (' . $this->sub_type . ')';
32
+            $message .= ' or location (' . $this->location . ')';
33 33
             $message .= ' cannot be empty.';
34 34
 
35 35
             throw new Exception($message);
Please login to merge, or discard this patch.
src/classes/Controller/UserController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
     public function getUserEditForm(ServerRequestInterface $request, ResponseInterface $response, $args)
99 99
     {
100
-        $this->logger->info("Fetch user GET '/user/".$args['id']."/edit'");
100
+        $this->logger->info("Fetch user GET '/user/" . $args['id'] . "/edit'");
101 101
         $u = UserQuery::create()->findPK($args['id']);
102 102
 
103 103
         if (is_null($u)) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     public function getUser(ServerRequestInterface $request, ResponseInterface $response, $args)
114 114
     {
115
-        $this->logger->info("Fetch user GET '/user/".$args['id']."'");
115
+        $this->logger->info("Fetch user GET '/user/" . $args['id'] . "'");
116 116
         $u = UserQuery::create()->findPK($args['id']);
117 117
 
118 118
         if (is_null($u)) {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function getUserWidgetOnly(ServerRequestInterface $request, ResponseInterface $response, $args)
129 129
     {
130
-        $this->logger->info("Fetch user GET '/user/".$args['id']."'");
130
+        $this->logger->info("Fetch user GET '/user/" . $args['id'] . "'");
131 131
         $u = UserQuery::create()->findPK($args['id']);
132 132
 
133 133
         if (is_null($u)) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     public function getUserPasswordForm(ServerRequestInterface $request, ResponseInterface $response, $args)
144 144
     {
145
-        $this->logger->info("Fetch user GET '/user/".$args['id']."/password'");
145
+        $this->logger->info("Fetch user GET '/user/" . $args['id'] . "/password'");
146 146
         $u = UserQuery::create()->findPK($args['id']);
147 147
 
148 148
         if (is_null($u)) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
     public function postUserPasswordChange(ServerRequestInterface $request, ResponseInterface $response, $args)
159 159
     {
160
-        $this->logger->info("Create user POST '/user/".$args['id']."/password'");
160
+        $this->logger->info("Create user POST '/user/" . $args['id'] . "/password'");
161 161
 
162 162
         $data = $request->getParsedBody();
163 163
 
Please login to merge, or discard this patch.
src/classes/AuthProvider/Callback/FacebookAuth.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         $path = $this->router->pathFor('login-callback', ['provider' => $this->getAuthProviderSlug()]);
45 45
 
46
-        $url = $this->baseUrl.$path;
46
+        $url = $this->baseUrl . $path;
47 47
 
48 48
         return $helper->getLoginUrl($url, $this->permissions);
49 49
     }
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
             $accessToken = $helper->getAccessToken();
57 57
         } catch (FacebookResponseException $e) {
58 58
             // When Graph returns an error
59
-            echo 'Graph returned an error: '.$e->getMessage();
59
+            echo 'Graph returned an error: ' . $e->getMessage();
60 60
 
61 61
             return false;
62 62
         } catch (FacebookSDKException $e) {
63 63
             // When validation fails or other local issues
64
-            echo 'Facebook SDK returned an error: '.$e->getMessage();
64
+            echo 'Facebook SDK returned an error: ' . $e->getMessage();
65 65
 
66 66
             return false;
67 67
         }
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
         if (!isset($accessToken)) {
70 70
             if ($helper->getError()) {
71 71
                 header('HTTP/1.0 401 Unauthorized');
72
-                echo 'Error: '.$helper->getError()."\n";
73
-                echo 'Error Code: '.$helper->getErrorCode()."\n";
74
-                echo 'Error Reason: '.$helper->getErrorReason()."\n";
75
-                echo 'Error Description: '.$helper->getErrorDescription()."\n";
72
+                echo 'Error: ' . $helper->getError() . "\n";
73
+                echo 'Error Code: ' . $helper->getErrorCode() . "\n";
74
+                echo 'Error Reason: ' . $helper->getErrorReason() . "\n";
75
+                echo 'Error Description: ' . $helper->getErrorDescription() . "\n";
76 76
             } else {
77 77
                 header('HTTP/1.0 400 Bad Request');
78 78
                 echo 'Bad request';
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             try {
99 99
                 $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
100 100
             } catch (FacebookSDKException $e) {
101
-                echo '<p>Error getting long-lived access token: '.$helper->getMessage()."</p>\n\n";
101
+                echo '<p>Error getting long-lived access token: ' . $helper->getMessage() . "</p>\n\n";
102 102
 
103 103
                 return false;
104 104
             }
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
             // Returns a `Facebook\FacebookResponse` object
123 123
             $response = $this->facebook->get('/me?fields=id,name,email', $accessToken);
124 124
         } catch (Facebook\Exceptions\FacebookResponseException $e) {
125
-            echo 'Graph returned an error: '.$e->getMessage();
125
+            echo 'Graph returned an error: ' . $e->getMessage();
126 126
             exit;
127 127
         } catch (Facebook\Exceptions\FacebookSDKException $e) {
128
-            echo 'Facebook SDK returned an error: '.$e->getMessage();
128
+            echo 'Facebook SDK returned an error: ' . $e->getMessage();
129 129
             exit;
130 130
         }
131 131
 
Please login to merge, or discard this patch.
src/dependencies.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $container = $app->getContainer();
20 20
 
21 21
 // TWIG view renderer
22
-$container['view'] = function ($c) {
22
+$container['view'] = function($c) {
23 23
     $settings = $c->get('settings')['renderer'];
24 24
     $view = new Twig($settings['template_path'], [
25 25
         'cache' => false, // or 'path/to/cache'
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $env = $view->getEnvironment();
42 42
     $env->addGlobal('site', new Site());
43 43
     $env->addGlobal('currenturl', $c->get('request')->getUri());
44
-    $env->addGlobal('currentpath', $c->get('request')->getUri()->getBasePath().'/'.$c->get('request')->getUri()->getPath());
44
+    $env->addGlobal('currentpath', $c->get('request')->getUri()->getBasePath() . '/' . $c->get('request')->getUri()->getPath());
45 45
 
46 46
     if (isset($_SESSION['userId'])) {
47 47
         $u = UserQuery::create()->findPk($_SESSION['userId']);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 };
55 55
 
56 56
 // monolog
57
-$container['logger'] = function ($c) {
57
+$container['logger'] = function($c) {
58 58
     $settings = $c->get('settings')['logger'];
59 59
     $logger = new Monolog\Logger($settings['name']);
60 60
     $logger->pushProcessor(new Monolog\Processor\UidProcessor());
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     return $logger;
64 64
 };
65 65
 
66
-$container['auth'] = function ($c) {
66
+$container['auth'] = function($c) {
67 67
     $authConfig = getConfig()['auth'];
68 68
 
69 69
     // full domain e.g. https://example.com
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             break;
82 82
 
83 83
         case 'onebody':
84
-            $url = $authConfig['onebody']['url'].'/';
84
+            $url = $authConfig['onebody']['url'] . '/';
85 85
             $email = new EmailAddress($authConfig['onebody']['email']);
86 86
             $apiKey = $authConfig['onebody']['apiKey'];
87 87
 
Please login to merge, or discard this patch.
public/old/event.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!empty($_GET['id'])) {
4
-    header('Location: ../event/'.(int) $_GET['id']);
4
+    header('Location: ../event/' . (int) $_GET['id']);
5 5
 }
Please login to merge, or discard this patch.
public/old/error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 <br>
47 47
 The following error has occurred
48 48
 <?php
49
-echo " on page '".$page."':<br><br>";
49
+echo " on page '" . $page . "':<br><br>";
50 50
     echo '<strong>';
51 51
 
52 52
     switch ($no) {
Please login to merge, or discard this patch.
public/old/editPassword.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 namespace TechWilk\Rota;
4 4
 
5 5
 if (!empty($_GET['id'])) {
6
-    header('Location: ../user/'.(int) $_GET['id'].'/password');
6
+    header('Location: ../user/' . (int) $_GET['id'] . '/password');
7 7
     exit;
8 8
 }
9 9
 
Please login to merge, or discard this patch.