Passed
Push — master ( 33631f...10f39b )
by Jan
03:09
created
src/Entity/User.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 class User extends NamedDBElement implements UserInterface, HasPermissionsInterface
49 49
 {
50 50
     /** The User id of the anonymous user */
51
-    const ID_ANONYMOUS      = 1;
51
+    const ID_ANONYMOUS = 1;
52 52
 
53 53
     /**
54 54
      * @ORM\Id()
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public function getIDString(): string
217 217
     {
218
-        return 'U' . sprintf('%06d', $this->getID());
218
+        return 'U'.sprintf('%06d', $this->getID());
219 219
     }
220 220
 
221 221
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     public function setName(string $new_name) : NamedDBElement
232 232
     {
233 233
         // Anonymous user is not allowed to change its username
234
-        if(!$this->isAnonymousUser()) {
234
+        if (!$this->isAnonymousUser()) {
235 235
             $this->name = $new_name;
236 236
         }
237 237
 
Please login to merge, or discard this patch.
src/Controller/UserController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
     public function userInfo(?User $user, Packages $packages)
57 57
     {
58 58
         //If no user id was passed, then we show info about the current user
59
-        if($user == null) {
59
+        if ($user == null) {
60 60
             $user = $this->getUser();
61 61
         } else {
62 62
             //Else we must check, if the current user is allowed to access $user
63 63
             $this->denyAccessUnlessGranted('read', $user);
64 64
         }
65 65
 
66
-        if($this->getParameter("use_gravatar")) {
66
+        if ($this->getParameter("use_gravatar")) {
67 67
             $avatar = $this->getGravatar($user->getEmail(), 200, 'identicon');
68 68
         } else {
69 69
             $avatar = $packages->getUrl("/img/default_avatar.png");
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $pw_form->handleRequest($request);
128 128
 
129 129
         //Check if password if everything was correct, then save it to User and DB
130
-        if($pw_form->isSubmitted() && $pw_form->isValid()) {
130
+        if ($pw_form->isSubmitted() && $pw_form->isValid()) {
131 131
             $password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData());
132 132
             $user->setPassword($password);
133 133
             $em->persist($user);
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
         $url .= md5(strtolower(trim($email)));
165 165
         $url .= "?s=$s&d=$d&r=$r";
166 166
         if ($img) {
167
-            $url = '<img src="' . $url . '"';
167
+            $url = '<img src="'.$url.'"';
168 168
             foreach ($atts as $key => $val) {
169
-                $url .= ' ' . $key . '="' . $val . '"';
169
+                $url .= ' '.$key.'="'.$val.'"';
170 170
             }
171 171
             $url .= ' />';
172 172
         }
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.