Passed
Pull Request — master (#211)
by Jan
11:02 queued 05:32
created
src/Security/Voter/PermissionVoter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
             $valid = $this->resolver->isValidOperation($perm, $op);
64 64
 
65 65
             //if an invalid operation is encountered, throw an exception so the developer knows it
66
-            if(!$valid) {
66
+            if (!$valid) {
67 67
                 throw new \RuntimeException('Encountered invalid permission operation "'.$op.'" for permission "'.$perm.'"!');
68 68
             }
69 69
 
Please login to merge, or discard this patch.
src/Security/Voter/AttachmentVoter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 
53 53
         //If the attachment has no element (which should not happen), we deny access, as we can not determine if the user is allowed to access the associated element
54 54
         $target_element = $subject->getElement();
55
-        if (! $subject instanceof Attachment || null === $target_element) {
55
+        if (!$subject instanceof Attachment || null === $target_element) {
56 56
             return false;
57 57
         }
58 58
 
Please login to merge, or discard this patch.
src/Security/Voter/ParameterVoter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
         } elseif ($subject instanceof SupplierParameter) {
113 113
             $param = 'suppliers';
114 114
         } else {
115
-            throw new RuntimeException('Encountered unknown Parameter type: ' . get_class($subject));
115
+            throw new RuntimeException('Encountered unknown Parameter type: '.get_class($subject));
116 116
         }
117 117
 
118 118
         return $this->resolver->inherit($user, $param, $attribute) ?? false;
Please login to merge, or discard this patch.
src/Security/Voter/OrderdetailVoter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 
62 62
     protected function voteOnUser(string $attribute, $subject, User $user): bool
63 63
     {
64
-        if (! is_a($subject, Orderdetail::class, true)) {
64
+        if (!is_a($subject, Orderdetail::class, true)) {
65 65
             throw new \RuntimeException('This voter can only handle Orderdetail objects!');
66 66
         }
67 67
 
Please login to merge, or discard this patch.
src/Security/Voter/PartLotVoter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 
62 62
     protected function voteOnUser(string $attribute, $subject, User $user): bool
63 63
     {
64
-        if (! is_a($subject, PartLot::class, true)) {
64
+        if (!is_a($subject, PartLot::class, true)) {
65 65
             throw new \RuntimeException('This voter can only handle PartLot objects!');
66 66
         }
67 67
 
Please login to merge, or discard this patch.
src/Command/User/UserListCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
                 $user->getUsername(),
70 70
                 $user->getFullName(),
71 71
                 $user->getEmail(),
72
-                $user->getGroup() !== null ? $user->getGroup()->getName() . ' (ID: ' . $user->getGroup()->getID() . ')' : 'No group',
72
+                $user->getGroup() !== null ? $user->getGroup()->getName().' (ID: '.$user->getGroup()->getID().')' : 'No group',
73 73
                 $user->isDisabled() ? 'Yes' : 'No',
74 74
             ]);
75 75
         }
Please login to merge, or discard this patch.
src/Command/User/UpgradePermissionsSchemaCommand.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $io = new SymfonyStyle($input, $output);
64 64
 
65
-        $io->info('Target schema version number: '. PermissionData::CURRENT_SCHEMA_VERSION);
65
+        $io->info('Target schema version number: '.PermissionData::CURRENT_SCHEMA_VERSION);
66 66
 
67 67
         //Retrieve all users and groups
68 68
         $users = $this->em->getRepository(User::class)->findAll();
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             }
83 83
         }
84 84
 
85
-        $io->info('Found '. count($groups_to_upgrade) .' groups and '. count($users_to_upgrade) .' users that need an update.');
85
+        $io->info('Found '.count($groups_to_upgrade).' groups and '.count($users_to_upgrade).' users that need an update.');
86 86
         if (empty($groups_to_upgrade) && empty($users_to_upgrade)) {
87 87
             $io->success('All users and group permissions schemas are up-to-date. No update needed.');
88 88
 
@@ -91,27 +91,27 @@  discard block
 block discarded – undo
91 91
 
92 92
         //List all users and groups that need an update
93 93
         $io->section('Groups that need an update:');
94
-        $io->listing(array_map(function (Group $group) {
95
-            return $group->getName() . ' (ID: '. $group->getID() .', Current version: ' . $group->getPermissions()->getSchemaVersion() . ')';
94
+        $io->listing(array_map(function(Group $group) {
95
+            return $group->getName().' (ID: '.$group->getID().', Current version: '.$group->getPermissions()->getSchemaVersion().')';
96 96
         }, $groups_to_upgrade));
97 97
 
98 98
         $io->section('Users that need an update:');
99
-        $io->listing(array_map(function (User $user) {
100
-            return $user->getUsername() . ' (ID: '. $user->getID() .', Current version: ' . $user->getPermissions()->getSchemaVersion() . ')';
99
+        $io->listing(array_map(function(User $user) {
100
+            return $user->getUsername().' (ID: '.$user->getID().', Current version: '.$user->getPermissions()->getSchemaVersion().')';
101 101
         }, $users_to_upgrade));
102 102
 
103
-        if(!$io->confirm('Continue with the update?', false)) {
103
+        if (!$io->confirm('Continue with the update?', false)) {
104 104
             $io->warning('Update aborted.');
105 105
             return 0;
106 106
         }
107 107
 
108 108
         //Update all users and groups
109 109
         foreach ($groups_to_upgrade as $group) {
110
-            $io->writeln('Updating group '. $group->getName() .' (ID: '. $group->getID() .') to schema version '. PermissionData::CURRENT_SCHEMA_VERSION .'...', OutputInterface::VERBOSITY_VERBOSE);
110
+            $io->writeln('Updating group '.$group->getName().' (ID: '.$group->getID().') to schema version '.PermissionData::CURRENT_SCHEMA_VERSION.'...', OutputInterface::VERBOSITY_VERBOSE);
111 111
             $this->permissionSchemaUpdater->upgradeSchema($group);
112 112
         }
113 113
         foreach ($users_to_upgrade as $user) {
114
-            $io->writeln('Updating user '. $user->getUsername() .' (ID: '. $user->getID() .') to schema version '. PermissionData::CURRENT_SCHEMA_VERSION .'...', OutputInterface::VERBOSITY_VERBOSE);
114
+            $io->writeln('Updating user '.$user->getUsername().' (ID: '.$user->getID().') to schema version '.PermissionData::CURRENT_SCHEMA_VERSION.'...', OutputInterface::VERBOSITY_VERBOSE);
115 115
             $this->permissionSchemaUpdater->upgradeSchema($user);
116 116
         }
117 117
 
Please login to merge, or discard this patch.
src/Command/User/UserEnableCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $all_users = $input->getOption('all');
61 61
         $disabling = $input->getOption('disable');
62 62
 
63
-        if(!$all_users && empty($usernames)) {
63
+        if (!$all_users && empty($usernames)) {
64 64
             $io->error('No users given! You have to pass atleast one username or use the --all option to use all users!');
65 65
             return self::FAILURE;
66 66
         }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         $repo = $this->entityManager->getRepository(User::class);
69 69
 
70 70
         $users = [];
71
-        if($all_users) { //If we requested to change all users at once, then get all users from repo
71
+        if ($all_users) { //If we requested to change all users at once, then get all users from repo
72 72
             $users = $repo->findAll();
73 73
         } else { //Otherwise, fetch the users from DB
74 74
             foreach ($usernames as $username) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             return [$user->getFullName(true), $user->isDisabled() ? 'Disabled' : 'Enabled'];
92 92
         }, $users));
93 93
 
94
-        if(!$io->confirm('Do you want to continue?')) {
94
+        if (!$io->confirm('Do you want to continue?')) {
95 95
             $io->warning('Aborting!');
96 96
             return self::SUCCESS;
97 97
         }
Please login to merge, or discard this patch.
src/Command/User/UsersPermissionsCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
         $inherit = !$input->getOption('noInherit') && !$edit_mode; //Show the non inherited perms in edit mode
72 72
 
73 73
         //Find user
74
-        $io->note('Finding user with username: ' . $username);
74
+        $io->note('Finding user with username: '.$username);
75 75
         $user = $this->userRepository->findByEmailOrName($username);
76 76
         if ($user === null) {
77
-            $io->error('No user found with username: ' . $username);
77
+            $io->error('No user found with username: '.$username);
78 78
             return Command::FAILURE;
79 79
         }
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         $edit_mapping = $this->renderPermissionTable($output, $user, $inherit);
84 84
 
85
-        while($edit_mode) {
85
+        while ($edit_mode) {
86 86
             $index_to_edit = $io->ask('Which permission do you want to edit? Enter the index (e.g. 2-4) to edit, * for all permissions or "q" to quit', 'q');
87 87
             if ($index_to_edit === 'q') {
88 88
                 break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                 $io->warning('You are about to edit all permissions. This will overwrite all permissions!');
98 98
             } else {
99 99
                 [$perm_to_edit, $op_to_edit] = $edit_mapping[$index_to_edit];
100
-                $io->note('Editing permission ' . $perm_to_edit . ' with operation <options=bold>' . $op_to_edit);
100
+                $io->note('Editing permission '.$perm_to_edit.' with operation <options=bold>'.$op_to_edit);
101 101
             }
102 102
 
103 103
 
Please login to merge, or discard this patch.