Passed
Push — master ( 6ed2ee...8d36bf )
by Jan
03:09
created
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/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 1 patch
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.
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.