Passed
Push — master ( 782e2b...0f3ba9 )
by Jan
02:56
created
src/Twig/AppExtension.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function generateEntityURL(DBElement $entity, string $method = 'info') : string
63 63
     {
64
-        switch($method) {
64
+        switch ($method) {
65 65
             case 'info':
66 66
                 return $this->entityURLGenerator->infoURL($entity);
67 67
             case 'edit':
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 
76 76
     public function parseBBCode(string $bbcode) : string
77 77
     {
78
-        if($bbcode === '') return '';
78
+        if ($bbcode === '') return '';
79 79
 
80
-        $item = $this->cache->getItem('bbcode_' . md5($bbcode));
81
-        if(!$item->isHit()) {
80
+        $item = $this->cache->getItem('bbcode_'.md5($bbcode));
81
+        if (!$item->isHit()) {
82 82
             $xml = TextFormatter::parse($bbcode);
83 83
             $item->set(TextFormatter::render($xml));
84 84
             $this->cache->save($item);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@
 block discarded – undo
75 75
 
76 76
     public function parseBBCode(string $bbcode) : string
77 77
     {
78
-        if($bbcode === '') return '';
78
+        if($bbcode === '') {
79
+         return '';
80
+        }
79 81
 
80 82
         $item = $this->cache->getItem('bbcode_' . md5($bbcode));
81 83
         if(!$item->isHit()) {
Please login to merge, or discard this patch.
src/Services/PermissionResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         //Read the permission config file...
57 57
         $config = Yaml::parse(
58
-            file_get_contents(__DIR__ . '/../../config/permissions.yaml')
58
+            file_get_contents(__DIR__.'/../../config/permissions.yaml')
59 59
         );
60 60
 
61 61
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
 
123 123
         $parent = $user->getGroup();
124
-        while($parent != null){ //The top group, has parent == null
124
+        while ($parent != null) { //The top group, has parent == null
125 125
             //Check if our current element gives a info about disallow/allow
126 126
             $allowed = $this->dontInherit($parent, $permission, $operation);
127 127
             if ($allowed !== null) {
Please login to merge, or discard this patch.
src/Entity/Group.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     public function getIDString(): string
75 75
     {
76
-        return 'G' . sprintf('%06d', $this->getID());
76
+        return 'G'.sprintf('%06d', $this->getID());
77 77
     }
78 78
 
79 79
     public function getPermissions(): PermissionsEmbed
Please login to merge, or discard this patch.
src/Security/Voter/ExtendedVoter.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
         // if the user is anonymous, we use the anonymous user.
64 64
         if (!$user instanceof User) {
65 65
             $user = $this->entityManager->find(User::class, User::ID_ANONYMOUS);
66
-            if($user === null) {
66
+            if ($user === null) {
67 67
                 return false;
68 68
             }
69 69
         }
Please login to merge, or discard this patch.
src/Security/Voter/UserVoter.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     protected function supports($attribute, $subject)
49 49
     {
50
-        if($subject instanceof User)
50
+        if ($subject instanceof User)
51 51
         {
52 52
             return in_array($attribute, array_merge(
53 53
                 $this->resolver->listOperationsForPermission('users'),
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function voteOnUser($attribute, $subject, User $user): bool
71 71
     {
72
-        if($subject instanceof User)
72
+        if ($subject instanceof User)
73 73
         {
74 74
             //Check if the checked user is the user itself
75
-            if($subject->getID() === $user->getID() &&
75
+            if ($subject->getID() === $user->getID() &&
76 76
                 $this->resolver->isValidOperation('self', $attribute)) {
77 77
                 //Then we also need to check the self permission
78 78
                 $tmp = $this->resolver->inherit($user, 'self', $attribute) ?? false;
79 79
                 //But if the self value is not allowed then use just the user value:
80
-                if($tmp)
80
+                if ($tmp)
81 81
                     return $tmp;
82 82
             }
83 83
             //Else just check users permission:
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,8 +77,9 @@
 block discarded – undo
77 77
                 //Then we also need to check the self permission
78 78
                 $tmp = $this->resolver->inherit($user, 'self', $attribute) ?? false;
79 79
                 //But if the self value is not allowed then use just the user value:
80
-                if($tmp)
81
-                    return $tmp;
80
+                if($tmp) {
81
+                                    return $tmp;
82
+                }
82 83
             }
83 84
             //Else just check users permission:
84 85
             return $this->resolver->inherit($user, 'users', $attribute) ?? false;
Please login to merge, or discard this patch.
src/Security/Voter/PartVoter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         {
34 34
 
35 35
             //Check if a sub permission should be checked -> $attribute has format name.edit
36
-            if(strpos($attribute, '.') !== false) {
36
+            if (strpos($attribute, '.') !== false) {
37 37
                 [$perm, $op] = explode('.', $attribute);
38 38
                 return in_array($op, $this->resolver->listOperationsForPermission('parts_'.$perm), false);
39 39
             }
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 
49 49
     protected function voteOnUser($attribute, $subject, User $user): bool
50 50
     {
51
-        if($subject instanceof Part) {
51
+        if ($subject instanceof Part) {
52 52
 
53 53
             //Check for sub permissions
54
-            if(strpos($attribute, '.') !== false) {
54
+            if (strpos($attribute, '.') !== false) {
55 55
                 [$perm, $op] = explode('.', $attribute);
56
-                return $this->resolver->inherit($user, 'parts_'. $perm, $op) ?? false;
56
+                return $this->resolver->inherit($user, 'parts_'.$perm, $op) ?? false;
57 57
             }
58 58
 
59 59
             //Null concealing operator means, that no
Please login to merge, or discard this patch.
src/Controller/PartController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             $em->persist($new_part);
118 118
             $em->flush();
119 119
             $this->addFlash('success', $translator->trans('part.created_flash'));
120
-            return $this->redirectToRoute('part_edit',['id' => $new_part->getID()]);
120
+            return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
121 121
         }
122 122
 
123 123
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             $em->persist($new_part);
149 149
             $em->flush();
150 150
             $this->addFlash('success', $translator->trans('part.created_flash'));
151
-            return $this->redirectToRoute('part_edit',['id' => $new_part->getID()]);
151
+            return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
152 152
         }
153 153
 
154 154
 
Please login to merge, or discard this patch.
src/Services/EntityURLGenerator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      */
61 61
     public function infoURL($entity) : string
62 62
     {
63
-        if($entity instanceof Part)
63
+        if ($entity instanceof Part)
64 64
         {
65 65
             return $this->urlGenerator->generate('part_info', ['id' => $entity->getID()]);
66 66
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function editURL($entity) : string
73 73
     {
74
-        if($entity instanceof Part)
74
+        if ($entity instanceof Part)
75 75
         {
76 76
             return $this->urlGenerator->generate('part_edit', ['id' => $entity->getID()]);
77 77
         }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
     public function createURL($entity) : string
84 84
     {
85
-        if($entity instanceof Part)
85
+        if ($entity instanceof Part)
86 86
         {
87 87
             return $this->urlGenerator->generate('part_new');
88 88
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function cloneURL($entity) : string
94 94
     {
95
-        if($entity instanceof Part)
95
+        if ($entity instanceof Part)
96 96
         {
97 97
             return $this->urlGenerator->generate('part_clone', ['id' => $entity->getID()]);
98 98
         }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $href = $this->infoURL($entity);
113 113
 
114
-        if($entity instanceof NamedDBElement)
114
+        if ($entity instanceof NamedDBElement)
115 115
         {
116 116
             return sprintf('<a href="%s">%s</a>', $href, $entity->getName());
117 117
         }
Please login to merge, or discard this patch.
src/Command/SetPasswordCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $user = $users[0];
51 51
 
52 52
 
53
-        if($user == null)
53
+        if ($user == null)
54 54
         {
55 55
             $io->error(sprintf('No user with the given username %s found in the database!', $user_name));
56 56
             return;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             sprintf('You are going to change the password of %s with ID %d. Proceed?',
63 63
                 $user->getFullName(true), $user->getID()));
64 64
 
65
-        if(!$proceed)
65
+        if (!$proceed)
66 66
         {
67 67
             return;
68 68
         }
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
         $success = false;
71 71
         $new_password = "";
72 72
 
73
-        while(!$success) {
73
+        while (!$success) {
74 74
             $pw1 = $io->askHidden("Please enter new password:");
75 75
             $pw2 = $io->askHidden('Please confirm:');
76
-            if($pw1 !== $pw2) {
76
+            if ($pw1 !== $pw2) {
77 77
                 $io->error('The entered password did not match! Please try again.');
78 78
             } else {
79 79
                 //Exit loop
Please login to merge, or discard this patch.