@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -131,8 +131,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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()); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | if ( ! array_key_exists($key, $actual)) { |
12 | 12 | $message = "Keys: Expected ($key) not found in Actual"; |
13 | 13 | return false; |
14 | - } elseif ( ! $this->AssertsArrayIsASubsetOf($expected[$key], $actual[$key], $message)){ |
|
14 | + } elseif ( ! $this->AssertsArrayIsASubsetOf($expected[$key], $actual[$key], $message)) { |
|
15 | 15 | $message .= " with key ($key)"; |
16 | 16 | return false; |
17 | 17 | } |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | { |
28 | 28 | if (is_array($expected) && is_array($actual)) { |
29 | 29 | foreach ($actual as $key => $value) { |
30 | - if (!array_key_exists($key, $expected)) { |
|
30 | + if ( ! array_key_exists($key, $expected)) { |
|
31 | 31 | $message = "Keys: Actual ($key) unexpected"; |
32 | 32 | return false; |
33 | - } elseif (!$this->AssertsReverseArrayIsASubsetOf($actual[$key], $expected[$key], $message)) { |
|
33 | + } elseif ( ! $this->AssertsReverseArrayIsASubsetOf($actual[$key], $expected[$key], $message)) { |
|
34 | 34 | $message .= " in key ($key)"; |
35 | 35 | return false; |
36 | 36 | } |
@@ -47,14 +47,14 @@ discard block |
||
47 | 47 | if (gettype($expected) != gettype($actual)) { |
48 | 48 | $message = "Mismatched Types: Expected (gettype($expected)) != Actual (gettype($actual))"; |
49 | 49 | return false; |
50 | - } elseif (gettype($expected) == 'object' ) { |
|
50 | + } elseif (gettype($expected) == 'object') { |
|
51 | 51 | $expected_class = get_class($expected); |
52 | 52 | $actual_class = get_class($actual); |
53 | - if( $expected_class != $actual_class ){ |
|
53 | + if ($expected_class != $actual_class) { |
|
54 | 54 | $message = "Objects classes: Expected ($expected_class) != Actual ($actual_class)"; |
55 | 55 | return false; |
56 | 56 | } |
57 | - if( ! $expected->equals($actual) ) { |
|
57 | + if ( ! $expected->equals($actual)) { |
|
58 | 58 | $message = "Objects: Expected ($expected) != Actual ($actual)"; |
59 | 59 | return false; |
60 | 60 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | public function __call($name, $arguments) |
24 | 24 | { |
25 | 25 | //TODO: hack ;-( |
26 | - if( in_array($name, ['setPropertiesBag', 'setSettersBag'], true) ){ |
|
26 | + if (in_array($name, ['setPropertiesBag', 'setSettersBag'], true)) { |
|
27 | 27 | $this->$name(...$arguments); |
28 | 28 | return; |
29 | - }elseif( in_array($name, ['getPropertiesBag','getSettersBag'], true) ){ |
|
29 | + }elseif (in_array($name, ['getPropertiesBag', 'getSettersBag'], true)) { |
|
30 | 30 | return $this->$name(...$arguments); |
31 | 31 | } |
32 | 32 | |
33 | - if( ! $this->isSetterAllowed($name) ) { |
|
33 | + if ( ! $this->isSetterAllowed($name)) { |
|
34 | 34 | $trace = debug_backtrace(); |
35 | 35 | trigger_error( |
36 | 36 | 'Disallowed getter/setter ' . $name . |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | $attribute = strtolower(substr($name, 3)); |
44 | - if($this->isSetter($name)){ |
|
44 | + if ($this->isSetter($name)) { |
|
45 | 45 | $this->$attribute = $arguments[0]; |
46 | - } elseif( $this->isGetter($name) ) { |
|
46 | + } elseif ($this->isGetter($name)) { |
|
47 | 47 | return $this->$attribute; |
48 | 48 | } else { |
49 | 49 | $name(...$arguments); |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | |
53 | 53 | public function equals($o): bool |
54 | 54 | { |
55 | - foreach ($this->setters as $getter){ |
|
56 | - if( $this->isGetter($getter) ) |
|
55 | + foreach ($this->setters as $getter) { |
|
56 | + if ($this->isGetter($getter)) |
|
57 | 57 | { |
58 | - if( $this->$getter() != $o->$getter() ) |
|
58 | + if ($this->$getter() != $o->$getter()) |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | if( in_array($name, ['setPropertiesBag', 'setSettersBag'], true) ){ |
27 | 27 | $this->$name(...$arguments); |
28 | 28 | return; |
29 | - }elseif( in_array($name, ['getPropertiesBag','getSettersBag'], true) ){ |
|
29 | + } elseif( in_array($name, ['getPropertiesBag','getSettersBag'], true) ){ |
|
30 | 30 | return $this->$name(...$arguments); |
31 | 31 | } |
32 | 32 | |
@@ -55,8 +55,9 @@ discard block |
||
55 | 55 | foreach ($this->setters as $getter){ |
56 | 56 | if( $this->isGetter($getter) ) |
57 | 57 | { |
58 | - if( $this->$getter() != $o->$getter() ) |
|
59 | - return false; |
|
58 | + if( $this->$getter() != $o->$getter() ) { |
|
59 | + return false; |
|
60 | + } |
|
60 | 61 | } |
61 | 62 | } |
62 | 63 | return true; |