Passed
Push — main ( 0545d9...29d231 )
by Proyecto
03:14
created
tools/makeUseCaseXsFromYCommandHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $resource_dir = 'resource/';
8 8
 $resource_file = 'UseCaseXsFromYCommandHandler.tpl';
9 9
 
10
-if( $argc != 4){
10
+if ($argc != 4) {
11 11
     echo "Usage:\n";
12 12
     echo "php tools/makeUseCaseXsFromYCommandHandler.php UseCase EntityX EntityY\n";
13 13
     exit(1);
@@ -24,26 +24,26 @@  discard block
 block discarded – undo
24 24
 
25 25
 $template = file_get_contents($resource_dir . $resource_file);
26 26
 
27
-if( DEBUG ){echo 'Template';echo $template;}
27
+if (DEBUG) {echo 'Template'; echo $template; }
28 28
 
29 29
 $next = str_replace('%usecase%', $usecase, $template);
30 30
 $next = str_replace('%Usecase%', $UseCase, $next);
31 31
 
32
-if( DEBUG ){echo 'next';echo $next;}
32
+if (DEBUG) {echo 'next'; echo $next; }
33 33
 
34 34
 $next = str_replace('%entityX%', $entityX, $next);
35 35
 $next = str_replace('%EntityX%', $EntityX, $next);
36 36
 
37
-if( DEBUG ){echo 'next';echo $next;}
37
+if (DEBUG) {echo 'next'; echo $next; }
38 38
 
39 39
 $next = str_replace('%entityY%', $entityY, $next);
40 40
 $next = str_replace('%EntityY%', $EntityY, $next);
41 41
 
42
-/*if( DEBUG ){echo 'next';*/echo $next;//}
42
+/*if( DEBUG ){echo 'next';*/echo $next; //}
43 43
 
44 44
 $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $EntityX . 'sFrom' . $EntityY . 'CommandHandler.php';
45 45
 
46
-if( ($count = file_force_contents($destination, $next)) === false ){
46
+if (($count = file_force_contents($destination, $next)) === false) {
47 47
     echo 'file_put_contents returned false';
48 48
 } else {
49 49
     echo $destination . ': ' . $count . ' bytes written';
Please login to merge, or discard this patch.
src/TAU/Common/InMemoryRepository.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,10 +251,11 @@  discard block
 block discarded – undo
251 251
             'available' => $available
252 252
         ];
253 253
 
254
-        foreach($from as $xKey => $xs)
255
-            foreach($xs as $yKey => $pair)
254
+        foreach($from as $xKey => $xs) {
255
+                    foreach($xs as $yKey => $pair)
256 256
                 if( $yKey === $entityY->getId() ) {
257 257
                     $r[$who][$xKey] = $pair[0];
258
+        }
258 259
                     unset($r['available'][$xKey]);
259 260
                 }
260 261
 
@@ -268,10 +269,11 @@  discard block
 block discarded – undo
268 269
             'available' => $available
269 270
         ];
270 271
 
271
-        foreach($from as $xKey => $xs)
272
-            foreach($xs as $yKey => $pair)
272
+        foreach($from as $xKey => $xs) {
273
+                    foreach($xs as $yKey => $pair)
273 274
                 if ($xKey === $entityX->getId()) {
274 275
                     $r[$who][$yKey] = $pair[1];
276
+        }
275 277
                     unset($r['available'][$yKey]);
276 278
                 }
277 279
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
             'available' => $available
288 288
         ];
289 289
 
290
-        foreach($from as $xKey => $xs)
291
-            foreach($xs as $yKey => $pair)
292
-                if( $yKey === $entityY->getId() ) {
290
+        foreach ($from as $xKey => $xs)
291
+            foreach ($xs as $yKey => $pair)
292
+                if ($yKey === $entityY->getId()) {
293 293
                     $r[$who][$xKey] = $pair[0];
294 294
                     unset($r['available'][$xKey]);
295 295
                 }
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
             'available' => $available
305 305
         ];
306 306
 
307
-        foreach($from as $xKey => $xs)
308
-            foreach($xs as $yKey => $pair)
307
+        foreach ($from as $xKey => $xs)
308
+            foreach ($xs as $yKey => $pair)
309 309
                 if ($xKey === $entityX->getId()) {
310 310
                     $r[$who][$yKey] = $pair[1];
311 311
                     unset($r['available'][$yKey]);
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
     private function failIfNotExists($entity, $id)
318 318
     {
319 319
         $datastore = strtolower($entity) . 'DataStore';
320
-        if( ! isset($this->$datastore[$id]) ){
321
-            throw new InvalidArgumentException(ucfirst($entity)." with id = {$id} not found");
320
+        if ( ! isset($this->$datastore[$id])) {
321
+            throw new InvalidArgumentException(ucfirst($entity) . " with id = {$id} not found");
322 322
         }
323 323
     }
324 324
 }
Please login to merge, or discard this patch.
src/TAU/Module/Administration/Group/Domain/Group.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
     use GroupUseCases;
22 22
 
23
-     public function __construct($id, $name, $desc)
24
-     {
23
+        public function __construct($id, $name, $desc)
24
+        {
25 25
         $this->setPropertiesBag(['id', 'name', 'desc']);
26 26
         $this->setSettersBag($this->getPropertiesBag());
27 27
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $this->setDesc($desc);
31 31
 
32 32
         // TODO: Raise CreateGroupDomainEvent($this)
33
-     }
33
+        }
34 34
 
35 35
     public function __toString()
36 36
     {
Please login to merge, or discard this patch.
src/TAU/Module/Administration/Role/Domain/Role.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
     use RoleUseCases;
22 22
 
23
-     public function __construct($id, $name, $desc)
24
-     {
23
+        public function __construct($id, $name, $desc)
24
+        {
25 25
         $this->setPropertiesBag(['id', 'name', 'desc']);
26 26
         $this->setSettersBag($this->getPropertiesBag());
27 27
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
         $this->setName($name);
30 30
         $this->setDesc($desc);
31 31
 
32
-		// TODO: Raise CreateRoleDomainEvent($this)
33
-     }
32
+        // TODO: Raise CreateRoleDomainEvent($this)
33
+        }
34 34
 
35 35
     public function __toString()
36 36
     {
Please login to merge, or discard this patch.
src/TAU/Module/Administration/Module/Domain/Module.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
     use ModuleUseCases;
22 22
 
23
-     public function __construct($id, $name, $desc)
24
-     {
23
+        public function __construct($id, $name, $desc)
24
+        {
25 25
         $this->setPropertiesBag(['id', 'name', 'desc']);
26 26
         $this->setSettersBag($this->getPropertiesBag());
27 27
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
         $this->setName($name);
30 30
         $this->setDesc($desc);
31 31
 		
32
-		// TODO: Raise CreateModuleDomainEvent($this)
33
-     }
32
+        // TODO: Raise CreateModuleDomainEvent($this)
33
+        }
34 34
 
35 35
     public function __toString()
36 36
     {
Please login to merge, or discard this patch.
src/TAU/Common/CommandRunner.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     public function execute(object $command, callable $next)
17 17
     {
18 18
         $commandName = \get_class($command);
19
-        $commandHandler = $commandName.$this->handler;
19
+        $commandHandler = $commandName . $this->handler;
20 20
         return // TODO: remove return from Coomands. It's for Queries only!!!
21 21
         app()->get($commandHandler)->handle($command);
22 22
     }
Please login to merge, or discard this patch.
src/TAU/Module/Administration/User/Domain/User.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@
 block discarded – undo
75 75
 
76 76
     public function equals($o): bool
77 77
     {
78
-        return $this->getid()       == $o->getid()
79
-            && $this->getName()     == $o->getName()
80
-            && $this->getSurname()  == $o->getSurname()
81
-            && $this->getLogin()    == $o->getLogin();
78
+        return $this->getid() == $o->getid()
79
+            && $this->getName() == $o->getName()
80
+            && $this->getSurname() == $o->getSurname()
81
+            && $this->getLogin() == $o->getLogin();
82 82
     }
83 83
 
84 84
     public function __toString()
Please login to merge, or discard this patch.
src/TAU/Common/PropertiesBag.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 trait PropertiesBag
6 6
 {
7 7
     private $attributes = [];
8
-	private $data = [];
8
+    private $data = [];
9 9
 
10
-	protected function setPropertiesBag($attributes)
10
+    protected function setPropertiesBag($attributes)
11 11
     {
12 12
         $this->attributes = $attributes;
13 13
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         return array_key_exists($name, $this->data);
42 42
     }
43 43
 
44
-	public function __set($name, $value)
44
+    public function __set($name, $value)
45 45
     {
46 46
         if( ! $this->isPropertyAllowed($name) ) {
47 47
             $trace = debug_backtrace();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $this->data[$name] = $value;
57 57
     }
58 58
 	
59
-	public function __get($name)
59
+    public function __get($name)
60 60
     {
61 61
         if( ! $this->isPropertyAllowed($name) ) {
62 62
             $trace = debug_backtrace();
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         return $this->data[$name];
82 82
     }
83 83
 	
84
-	public function __isset($name)
84
+    public function __isset($name)
85 85
     {
86 86
         if( ! $this->isPropertyAllowed($name) ) {
87 87
             $trace = debug_backtrace();
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public function __set($name, $value)
45 45
     {
46
-        if( ! $this->isPropertyAllowed($name) ) {
46
+        if ( ! $this->isPropertyAllowed($name)) {
47 47
             $trace = debug_backtrace();
48 48
             trigger_error(
49 49
                 'Disallowed property ' . $name .
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	
59 59
 	public function __get($name)
60 60
     {
61
-        if( ! $this->isPropertyAllowed($name) ) {
61
+        if ( ! $this->isPropertyAllowed($name)) {
62 62
             $trace = debug_backtrace();
63 63
             trigger_error(
64 64
                 'Disallowed property ' . $name .
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             return null;
69 69
         }
70 70
 
71
-        if( ! $this->isDefined($name)) {
71
+        if ( ! $this->isDefined($name)) {
72 72
             $trace = debug_backtrace();
73 73
             trigger_error(
74 74
                 'Undefined property ' . $name .
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	
84 84
 	public function __isset($name)
85 85
     {
86
-        if( ! $this->isPropertyAllowed($name) ) {
86
+        if ( ! $this->isPropertyAllowed($name)) {
87 87
             $trace = debug_backtrace();
88 88
             trigger_error(
89 89
                 'Disallowed property ' . $name .
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             return null;
94 94
         }
95 95
 
96
-        if( ! $this->isDefined($name)) {
96
+        if ( ! $this->isDefined($name)) {
97 97
             $trace = debug_backtrace();
98 98
             trigger_error(
99 99
                 'Undefined property ' . $name .
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     public function __unset($name)
110 110
     {
111
-        if( ! $this->isPropertyAllowed($name) ) {
111
+        if ( ! $this->isPropertyAllowed($name)) {
112 112
             $trace = debug_backtrace();
113 113
             trigger_error(
114 114
                 'Disallowed property ' . $name .
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             return null;
119 119
         }
120 120
 
121
-        if( ! $this->isDefined($name)) {
121
+        if ( ! $this->isDefined($name)) {
122 122
             $trace = debug_backtrace();
123 123
             trigger_error(
124 124
                 'Undefined property ' . $name .
Please login to merge, or discard this patch.
src/TAU/Common/SQLiteRepository.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
             self::$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
46 46
             //self::$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
47 47
         } catch (PDOException $e) {
48
-            die($e->getMessage().' ('.$dbname.')');
48
+            die($e->getMessage() . ' (' . $dbname . ')');
49 49
         }
50 50
     }
51 51
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     public function createUser(User $user): void
114 114
     {
115
-        $ps = self::$db->prepare('INSERT INTO User (user_id, name, surname, login)'.
115
+        $ps = self::$db->prepare('INSERT INTO User (user_id, name, surname, login)' .
116 116
                                             ' VALUES(:user_id, :name, :surname, :login);');
117 117
         $this->executeOrFail($ps, [
118 118
             ':user_id' => $user->getId(),
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $this->executeOrFail($ps, [':id' => $id]);
132 132
 
133 133
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
134
-        if( $resultSet === false )
134
+        if ($resultSet === false)
135 135
             throw new InvalidArgumentException("User with id = {$id} not found");
136 136
 
137 137
         $ref = new \ReflectionClass(User::class);
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function updateUser($id, $name, $surname, $login): void
151 151
     {
152
-        $ps = self::$db->prepare('UPDATE User SET '.
153
-                                            'name = :name,'.
154
-                                            'surname = :surname,'.
155
-                                            'login = :login'.
152
+        $ps = self::$db->prepare('UPDATE User SET ' .
153
+                                            'name = :name,' .
154
+                                            'surname = :surname,' .
155
+                                            'login = :login' .
156 156
                                             ' WHERE user_id = :id;');
157 157
 
158 158
         $this->executeOrFail($ps, [
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
     public function getGroupsFromUser(User $user): array // TODO id instead of User
178 178
     {
179
-        $ps = self::$db->prepare('SELECT group_pk, g.group_id, name, description FROM "Group" g'.
180
-                                        ' INNER JOIN user_group rel ON g.group_pk = rel.group_fk'.
179
+        $ps = self::$db->prepare('SELECT group_pk, g.group_id, name, description FROM "Group" g' .
180
+                                        ' INNER JOIN user_group rel ON g.group_pk = rel.group_fk' .
181 181
                                         ' WHERE rel.user_fk = :user_fk;');
182 182
 
183 183
         $id = $user->getid();
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
     private function queryOrFail($ps, $params = []): array
223 223
     {
224 224
         $this->executeOrFail($ps, $params);
225
-        $resultSet =  $ps->fetchAll(PDO::FETCH_ASSOC);
225
+        $resultSet = $ps->fetchAll(PDO::FETCH_ASSOC);
226 226
 
227 227
         return $resultSet;
228 228
     }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     private function executeOrFail($ps, $params = [], $a = 0): void
231 231
     {
232 232
         $a = 1;
233
-        if($a) {
233
+        if ($a) {
234 234
             $sql = $ps->queryString;
235 235
             $b = str_replace(array_keys($params), array_values($params), $sql);
236 236
             echo "\n$b\n";
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 
239 239
         $result = $ps->execute($params);
240 240
 
241
-        if( $result === false ) {
241
+        if ($result === false) {
242 242
             $a = 1;
243
-            if($a) {
243
+            if ($a) {
244 244
                 $sql = $ps->queryString;
245 245
                 $b = str_replace(array_keys($params), array_values($params), $sql);
246 246
                 echo "\n$b\n";
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 
279 279
     public function createGroup(Group $group)
280 280
     {
281
-        $ps = self::$db->prepare('INSERT INTO "Group" (group_id, name, description)'.
281
+        $ps = self::$db->prepare('INSERT INTO "Group" (group_id, name, description)' .
282 282
                                             ' VALUES(:group_id, :name, :description);');
283 283
         $this->executeOrFail($ps, [
284 284
             ':group_id' => $group->getId(),
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $this->executeOrFail($ps, [':id' => $id]);
297 297
 
298 298
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
299
-        if( $resultSet === false )
299
+        if ($resultSet === false)
300 300
             throw new InvalidArgumentException("Group with id = {$id} not found");
301 301
 
302 302
         $ref = new \ReflectionClass(Group::class);
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
316 316
 
317 317
     public function updateGroup($id, $name, $desc)
318 318
     {
319
-        $ps = self::$db->prepare('UPDATE "Group" SET '.
320
-                                            'name = :name,'.
321
-                                            'description = :description'.
319
+        $ps = self::$db->prepare('UPDATE "Group" SET ' .
320
+                                            'name = :name,' .
321
+                                            'description = :description' .
322 322
                                             ' WHERE group_id = :id;');
323 323
 
324 324
         $this->executeOrFail($ps, [
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 
342 342
     public function getUsersFromGroup(Group $group)
343 343
     {
344
-        $ps = self::$db->prepare('SELECT user_pk, u.user_id, name, surname, login FROM User u'.
345
-                                        ' INNER JOIN user_group rel ON u.user_pk = rel.user_fk'.
344
+        $ps = self::$db->prepare('SELECT user_pk, u.user_id, name, surname, login FROM User u' .
345
+                                        ' INNER JOIN user_group rel ON u.user_pk = rel.user_fk' .
346 346
                                         ' WHERE rel.group_fk = :group_fk;');
347 347
 
348 348
         $id = $group->getId();
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     {
401 401
         /*$ps = self::$db->prepare('INSERT INTO user_group (user_fk, group_fk, user_id, group_id)'.
402 402
                                         ' VALUES (:user_fk, :group_fk, :user_id, :group_id);');*/
403
-        $ps = self::$db->prepare('INSERT INTO user_group (user_fk, group_fk)'.
403
+        $ps = self::$db->prepare('INSERT INTO user_group (user_fk, group_fk)' .
404 404
                                         ' VALUES (:user_fk, :group_fk);');
405 405
 
406 406
         $this->executeOrFail($ps, [
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 
414 414
     public function removeUserFromGroup(User $user, Group $group)
415 415
     {
416
-        $ps = self::$db->prepare('DELETE FROM user_group WHERE user_fk = :user_fk'.
416
+        $ps = self::$db->prepare('DELETE FROM user_group WHERE user_fk = :user_fk' .
417 417
                                         ' AND group_fk = :group_fk;');
418 418
 
419 419
         $this->executeOrFail($ps, [
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 
427 427
     public function createRole(Role $role)
428 428
     {
429
-        $ps = self::$db->prepare('INSERT INTO Role (role_id, name, description)'.
429
+        $ps = self::$db->prepare('INSERT INTO Role (role_id, name, description)' .
430 430
                                         ' VALUES(:role_id, :name, :description);');
431 431
 
432 432
         $this->executeOrFail($ps, [
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         $this->executeOrFail($ps, [':id' => $id]);
446 446
 
447 447
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
448
-        if( $resultSet === false )
448
+        if ($resultSet === false)
449 449
             throw new InvalidArgumentException("Role with id = {$id} not found");
450 450
 
451 451
         $ref = new \ReflectionClass(Role::class);
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
     public function addGroupToRole(Group $group, Role $role)
472 472
     {
473
-        $ps = self::$db->prepare('INSERT INTO group_role (group_fk, role_fk, group_id, role_id)'.
473
+        $ps = self::$db->prepare('INSERT INTO group_role (group_fk, role_fk, group_id, role_id)' .
474 474
                                         ' VALUES (:group_fk, :role_fk, :group_id, :role_id);');
475 475
 
476 476
         $this->executeOrFail($ps, [
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 
484 484
     public function getGroupsFromRole(Role $role)
485 485
     {
486
-        $ps = self::$db->prepare('SELECT group_pk, g.group_id, name, description FROM "Group" g'.
487
-            ' INNER JOIN group_role rel ON g.group_pk = rel.group_fk'.
486
+        $ps = self::$db->prepare('SELECT group_pk, g.group_id, name, description FROM "Group" g' .
487
+            ' INNER JOIN group_role rel ON g.group_pk = rel.group_fk' .
488 488
             ' WHERE rel.role_fk = :role_fk;');
489 489
 
490 490
         $id = $role->getId();
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 
519 519
     public function removeGroupFromRole(Group $group, Role $role)
520 520
     {
521
-        $ps = self::$db->prepare('DELETE FROM group_role WHERE group_fk = :group_fk'.
521
+        $ps = self::$db->prepare('DELETE FROM group_role WHERE group_fk = :group_fk' .
522 522
                                         ' AND role_fk = :role_fk;');
523 523
 
524 524
         $this->executeOrFail($ps, [
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
     public function addGroupToUser(Group $group, User $user)
533 533
     {
534
-        $ps = self::$db->prepare('INSERT INTO user_group (user_fk, group_fk, group_id, user_id)'.
534
+        $ps = self::$db->prepare('INSERT INTO user_group (user_fk, group_fk, group_id, user_id)' .
535 535
                                         ' VALUES (:user_fk, :group_fk, :user_id, :group_id);');
536 536
 
537 537
         $this->executeOrFail($ps, [
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
     public function removeGroupFromUser(Group $group, User $user)
546 546
     {
547
-        $ps = self::$db->prepare('DELETE FROM user_group WHERE user_fk = :user_fk'.
547
+        $ps = self::$db->prepare('DELETE FROM user_group WHERE user_fk = :user_fk' .
548 548
             ' AND group_fk = :group_fk;');
549 549
 
550 550
         $this->executeOrFail($ps, [
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
 
558 558
     public function updateRole($id, $name, $desc)
559 559
     {
560
-        $ps = self::$db->prepare('UPDATE Role SET '.
561
-            'name = :name,'.
562
-            'description = :description'.
560
+        $ps = self::$db->prepare('UPDATE Role SET ' .
561
+            'name = :name,' .
562
+            'description = :description' .
563 563
             ' WHERE role_id = :id;');
564 564
 
565 565
         $this->executeOrFail($ps, [
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
     public function addRoleToGroup(Role $role, Group $group)
584 584
     {
585
-        $ps = self::$db->prepare('INSERT INTO group_role (group_fk, role_fk, group_id, role_id)'.
585
+        $ps = self::$db->prepare('INSERT INTO group_role (group_fk, role_fk, group_id, role_id)' .
586 586
                                         ' VALUES (:group_fk, :role_fk, :group_id, :role_id);');
587 587
 
588 588
         $this->executeOrFail($ps, [
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 
596 596
     public function getRolesFromGroup(Group $group)
597 597
     {
598
-        $ps = self::$db->prepare('SELECT role_pk, r.role_id, name, description FROM Role r'.
599
-            ' INNER JOIN group_role rel ON r.role_pk = rel.role_fk'.
598
+        $ps = self::$db->prepare('SELECT role_pk, r.role_id, name, description FROM Role r' .
599
+            ' INNER JOIN group_role rel ON r.role_pk = rel.role_fk' .
600 600
             ' WHERE rel.group_fk = :group_fk;');
601 601
 
602 602
         $id = $group->getId();
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
     public function removeRoleFromGroup(Role $role, Group $group)
658 658
     {
659
-        $ps = self::$db->prepare('DELETE FROM group_role WHERE role_fk = :role_fk'.
659
+        $ps = self::$db->prepare('DELETE FROM group_role WHERE role_fk = :role_fk' .
660 660
                                         ' AND group_fk = :group_fk;');
661 661
 
662 662
         $this->executeOrFail($ps, [
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 
670 670
     public function addModuleToRole(Module $module, Role $role)
671 671
     {
672
-        $ps = self::$db->prepare('INSERT INTO role_module (role_fk, module_fk, role_id, module_id)'.
672
+        $ps = self::$db->prepare('INSERT INTO role_module (role_fk, module_fk, role_id, module_id)' .
673 673
             ' VALUES (:role_fk, :module_fk, :role_id, :module_id);');
674 674
 
675 675
         $this->executeOrFail($ps, [
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 
683 683
     public function removeModuleFromRole(Module $module, Role $role)
684 684
     {
685
-        $ps = self::$db->prepare('DELETE FROM role_module WHERE role_fk = :role_fk'.
685
+        $ps = self::$db->prepare('DELETE FROM role_module WHERE role_fk = :role_fk' .
686 686
                                         ' AND module_fk = :module_fk;');
687 687
 
688 688
         $this->executeOrFail($ps, [
@@ -695,8 +695,8 @@  discard block
 block discarded – undo
695 695
 
696 696
     public function getModulesFromRole(Role $role)
697 697
     {
698
-        $ps = self::$db->prepare('SELECT module_pk, m.module_id, name, description FROM Module m'.
699
-                                        ' INNER JOIN role_module rel ON m.module_pk = rel.module_fk'.
698
+        $ps = self::$db->prepare('SELECT module_pk, m.module_id, name, description FROM Module m' .
699
+                                        ' INNER JOIN role_module rel ON m.module_pk = rel.module_fk' .
700 700
                                         ' WHERE rel.role_fk = :role_fk;');
701 701
 
702 702
         $id = $role->getId();
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 
762 762
     public function createModule(Module $module)
763 763
     {
764
-        $ps = self::$db->prepare('INSERT INTO Module (module_id, name, description)'.
764
+        $ps = self::$db->prepare('INSERT INTO Module (module_id, name, description)' .
765 765
                                         ' VALUES(:module_id, :name, :description);');
766 766
         $this->executeOrFail($ps, [
767 767
             ':module_id' => $module->getId(),
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
         $this->executeOrFail($ps, [':id' => $id]);
780 780
 
781 781
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
782
-        if( $resultSet === false )
782
+        if ($resultSet === false)
783 783
             throw new InvalidArgumentException("Module with id = {$id} not found");
784 784
 
785 785
         $ref = new \ReflectionClass(Module::class);
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 
800 800
     public function updateModule($id, $name, $desc)
801 801
     {
802
-        $ps = self::$db->prepare('UPDATE Module SET '.
803
-                                        'name = :name,'.
804
-                                        'description = :description'.
802
+        $ps = self::$db->prepare('UPDATE Module SET ' .
803
+                                        'name = :name,' .
804
+                                        'description = :description' .
805 805
                                         ' WHERE module_id = :id;');
806 806
 
807 807
         $this->executeOrFail($ps, [
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
 
835 835
     public function getRolesFromModule(Module $module)
836 836
     {
837
-        $ps = self::$db->prepare('SELECT role_pk, r.role_id, name, description FROM Role r'.
838
-            ' INNER JOIN role_module rel ON r.role_pk = rel.role_fk'.
837
+        $ps = self::$db->prepare('SELECT role_pk, r.role_id, name, description FROM Role r' .
838
+            ' INNER JOIN role_module rel ON r.role_pk = rel.role_fk' .
839 839
             ' WHERE rel.module_fk = :module_fk;');
840 840
 
841 841
         $id = $module->getId();
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -131,8 +131,9 @@  discard block
 block discarded – undo
131 131
         $this->executeOrFail($ps, [':id' => $id]);
132 132
 
133 133
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
134
-        if( $resultSet === false )
135
-            throw new InvalidArgumentException("User with id = {$id} not found");
134
+        if( $resultSet === false ) {
135
+                    throw new InvalidArgumentException("User with id = {$id} not found");
136
+        }
136 137
 
137 138
         $ref = new \ReflectionClass(User::class);
138 139
         $user = $this->castUser($ref->newInstanceWithoutConstructor());
@@ -296,8 +297,9 @@  discard block
 block discarded – undo
296 297
         $this->executeOrFail($ps, [':id' => $id]);
297 298
 
298 299
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
299
-        if( $resultSet === false )
300
-            throw new InvalidArgumentException("Group with id = {$id} not found");
300
+        if( $resultSet === false ) {
301
+                    throw new InvalidArgumentException("Group with id = {$id} not found");
302
+        }
301 303
 
302 304
         $ref = new \ReflectionClass(Group::class);
303 305
         $group = $this->castGroup($ref->newInstanceWithoutConstructor());
@@ -445,8 +447,9 @@  discard block
 block discarded – undo
445 447
         $this->executeOrFail($ps, [':id' => $id]);
446 448
 
447 449
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
448
-        if( $resultSet === false )
449
-            throw new InvalidArgumentException("Role with id = {$id} not found");
450
+        if( $resultSet === false ) {
451
+                    throw new InvalidArgumentException("Role with id = {$id} not found");
452
+        }
450 453
 
451 454
         $ref = new \ReflectionClass(Role::class);
452 455
         $role = $this->castRole($ref->newInstanceWithoutConstructor());
@@ -779,8 +782,9 @@  discard block
 block discarded – undo
779 782
         $this->executeOrFail($ps, [':id' => $id]);
780 783
 
781 784
         $resultSet = $ps->fetch(PDO::FETCH_ASSOC);
782
-        if( $resultSet === false )
783
-            throw new InvalidArgumentException("Module with id = {$id} not found");
785
+        if( $resultSet === false ) {
786
+                    throw new InvalidArgumentException("Module with id = {$id} not found");
787
+        }
784 788
 
785 789
         $ref = new \ReflectionClass(Module::class);
786 790
         $module = $this->castModule($ref->newInstanceWithoutConstructor());
Please login to merge, or discard this patch.