Passed
Push — master ( d3112e...550b1b )
by Luiz Kim
14:55 queued 06:04
created
src/Repository/UserRepository.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
     public function updatePassword(string $email, string $password): ?User
29 29
     {
30 30
         if ($user = $this->findOneByEmail($email)) {
31
-          $user->setPassword($password);
31
+            $user->setPassword($password);
32 32
 
33
-          $this->getEntityManager()->persist($user);
33
+            $this->getEntityManager()->persist($user);
34 34
 
35
-          $this->getEntityManager()->flush();
35
+            $this->getEntityManager()->flush();
36 36
 
37
-          return $user;
37
+            return $user;
38 38
         }
39 39
     }
40 40
 
Please login to merge, or discard this patch.
src/Controller/Oauth/InstagramController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         $this->provider = new Instagram([
28 28
             'clientId'     => $this->clientId,
29 29
             'clientSecret' => $this->clientSecret,
30
-            'redirectUri'  => 'https://' .$this->domainService->getMainDomain() . '/oauth/instagram/return',
30
+            'redirectUri'  => 'https://' . $this->domainService->getMainDomain() . '/oauth/instagram/return',
31 31
             //'hostedDomain' => 'example.com', // optional; used to restrict access to users on your G Suite/Instagram Apps for Business accounts
32 32
         ]);
33 33
     }
Please login to merge, or discard this patch.
src/Controller/ChangePasswordAction.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
   {
24 24
 
25 25
     try {
26
-      $payload   = json_decode($request->getContent());
26
+      $payload = json_decode($request->getContent());
27 27
 
28 28
       $user = $this->service->changePassword($data, $payload->password);
29 29
 
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,38 +12,38 @@
 block discarded – undo
12 12
 class ChangePasswordAction
13 13
 {
14 14
 
15
-  public function __construct(
15
+    public function __construct(
16 16
     private EntityManagerInterface $manager,
17 17
     private UserService $service,
18 18
     private HydratorService $hydratorService
19 19
 
20
-  ) {}
20
+    ) {}
21 21
 
22
-  public function __invoke(User $data, Request $request)
23
-  {
22
+    public function __invoke(User $data, Request $request)
23
+    {
24 24
 
25 25
     try {
26
-      $payload   = json_decode($request->getContent());
26
+        $payload   = json_decode($request->getContent());
27 27
 
28
-      $user = $this->service->changePassword($data, $payload->password);
28
+        $user = $this->service->changePassword($data, $payload->password);
29 29
 
30
-      return new JsonResponse(
30
+        return new JsonResponse(
31 31
         $this->hydratorService->item(
32
-          User::class,
33
-          $user->getId(),
34
-          "user:read"
32
+            User::class,
33
+            $user->getId(),
34
+            "user:read"
35 35
         )
36
-      );
36
+        );
37 37
     } catch (\Exception $e) {
38 38
 
39
-      return new JsonResponse([
39
+        return new JsonResponse([
40 40
         'response' => [
41
-          'data'    => [],
42
-          'count'   => 0,
43
-          'error'   => $e->getMessage(),
44
-          'success' => false,
41
+            'data'    => [],
42
+            'count'   => 0,
43
+            'error'   => $e->getMessage(),
44
+            'success' => false,
45 45
         ],
46
-      ], 500);
46
+        ], 500);
47
+    }
47 48
     }
48
-  }
49 49
 }
Please login to merge, or discard this patch.
src/Controller/CreateUserAction.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
   {
25 25
 
26 26
     try {
27
-      $payload   = json_decode($request->getContent());
28
-      $people =  $this->manager->getRepository(People::class)->find($payload->people);
27
+      $payload = json_decode($request->getContent());
28
+      $people = $this->manager->getRepository(People::class)->find($payload->people);
29 29
 
30 30
       $user = $this->service->createUser(
31 31
         $people,
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,43 +13,43 @@
 block discarded – undo
13 13
 class CreateUserAction
14 14
 {
15 15
 
16
-  public function __construct(
16
+    public function __construct(
17 17
     private EntityManagerInterface $manager,
18 18
     private UserService $service,
19 19
     private HydratorService $hydratorService
20 20
 
21
-  ) {}
21
+    ) {}
22 22
 
23
-  public function __invoke(Request $request)
24
-  {
23
+    public function __invoke(Request $request)
24
+    {
25 25
 
26 26
     try {
27
-      $payload   = json_decode($request->getContent());
28
-      $people =  $this->manager->getRepository(People::class)->find($payload->people);
27
+        $payload   = json_decode($request->getContent());
28
+        $people =  $this->manager->getRepository(People::class)->find($payload->people);
29 29
 
30
-      $user = $this->service->createUser(
30
+        $user = $this->service->createUser(
31 31
         $people,
32 32
         $payload->username,
33 33
         $payload->password
34
-      );
34
+        );
35 35
 
36
-      return new JsonResponse(
36
+        return new JsonResponse(
37 37
         $this->hydratorService->item(
38
-          User::class,
39
-          $user->getId(),
40
-          "user:read"
38
+            User::class,
39
+            $user->getId(),
40
+            "user:read"
41 41
         )
42
-      );
42
+        );
43 43
     } catch (\Exception $e) {
44 44
 
45
-      return new JsonResponse([
45
+        return new JsonResponse([
46 46
         'response' => [
47
-          'data'    => [],
48
-          'count'   => 0,
49
-          'error'   => $e->getMessage(),
50
-          'success' => false,
47
+            'data'    => [],
48
+            'count'   => 0,
49
+            'error'   => $e->getMessage(),
50
+            'success' => false,
51 51
         ],
52
-      ], 500);
52
+        ], 500);
53
+    }
53 54
     }
54
-  }
55 55
 }
Please login to merge, or discard this patch.
src/Controller/ChangeApiKeyAction.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
 class ChangeApiKeyAction
12 12
 {
13 13
 
14
-  public function __construct(
14
+    public function __construct(
15 15
     private EntityManagerInterface $manager,
16 16
     private UserService $service,
17 17
     private HydratorService $hydratorService
18 18
 
19
-  ) {}
19
+    ) {}
20 20
 
21
-  public function __invoke(User $data)
22
-  {
21
+    public function __invoke(User $data)
22
+    {
23 23
 
24 24
     try {
25 25
 
26
-      $user = $this->service->changeApiKey($data);
26
+        $user = $this->service->changeApiKey($data);
27 27
 
28
-      return new JsonResponse(
28
+        return new JsonResponse(
29 29
         $this->hydratorService->item(
30
-          User::class,
31
-          $user->getId(),
32
-          "user:read"
30
+            User::class,
31
+            $user->getId(),
32
+            "user:read"
33 33
         )
34
-      );
34
+        );
35 35
     } catch (\Exception $e) {
36 36
 
37
-      return new JsonResponse([
37
+        return new JsonResponse([
38 38
         'response' => [
39
-          'data'    => [],
40
-          'count'   => 0,
41
-          'error'   => $e->getMessage(),
42
-          'success' => false,
39
+            'data'    => [],
40
+            'count'   => 0,
41
+            'error'   => $e->getMessage(),
42
+            'success' => false,
43 43
         ],
44
-      ], 500);
44
+        ], 500);
45
+    }
45 46
     }
46
-  }
47 47
 }
Please login to merge, or discard this patch.
src/Controller/Oauth/DefaultClientController.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,20 +34,23 @@
 block discarded – undo
34 34
         try {
35 35
 
36 36
 
37
-            if ($request->get('code'))
38
-                $token = $this->provider->getAccessToken('authorization_code', [
37
+            if ($request->get('code')) {
38
+                            $token = $this->provider->getAccessToken('authorization_code', [
39 39
                     'code' => $request->get('code')
40 40
                 ]);
41
+            }
41 42
 
42
-            if ($request->get('access_token'))
43
-                $token = new AccessToken([
43
+            if ($request->get('access_token')) {
44
+                            $token = new AccessToken([
44 45
                     'access_token' => $request->get('access_token'),
45 46
                 ]);
47
+            }
46 48
 
47
-            if ($request->get('code'))
48
-                $token = $this->provider->getAccessToken('authorization_code', [
49
+            if ($request->get('code')) {
50
+                            $token = $this->provider->getAccessToken('authorization_code', [
49 51
                     'code' => $request->get('code')
50 52
                 ]);
53
+            }
51 54
 
52 55
             $ownerDetails = $this->provider->getResourceOwner($token);
53 56
 
Please login to merge, or discard this patch.
src/Controller/SecurityController.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-  public function __construct(
17
+    public function __construct(
18 18
     private PeopleRoleService $roleService,
19 19
     private EntityManagerInterface $manager,
20 20
     protected UserService $userService
21
-  ) {}
21
+    ) {}
22 22
 
23
-  public function __invoke(Request $request)
24
-  {
23
+    public function __invoke(Request $request)
24
+    {
25 25
     /**
26 26
      * @var \ControleOnline\Entity\User
27 27
      */
28 28
     $user = $this->getUser();
29 29
 
30 30
     if ($user === null)
31
-      return $this->json([
31
+        return $this->json([
32 32
         'error' => 'User not found'
33
-      ]);
33
+        ]);
34 34
 
35 35
     return $this->json($this->userService->getUserSession($user));
36 36
 
37
-  }
37
+    }
38 38
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,10 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     $user = $this->getUser();
29 29
 
30
-    if ($user === null)
31
-      return $this->json([
30
+    if ($user === null) {
31
+          return $this->json([
32 32
         'error' => 'User not found'
33 33
       ]);
34
+    }
34 35
 
35 36
     return $this->json($this->userService->getUserSession($user));
36 37
 
Please login to merge, or discard this patch.
src/Controller/CreateAccountAction.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@
 block discarded – undo
24 24
   {
25 25
 
26 26
     try {
27
-      $payload   = json_decode($request->getContent());
28
-      $people =  $this->service->discoveryPeople($payload->email, $payload->name);
27
+      $payload = json_decode($request->getContent());
28
+      $people = $this->service->discoveryPeople($payload->email, $payload->name);
29 29
 
30 30
       $user = $this->service->getUserSession($this->service->createUser(
31 31
         $people,
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,43 +13,43 @@
 block discarded – undo
13 13
 class CreateAccountAction
14 14
 {
15 15
 
16
-  public function __construct(
16
+    public function __construct(
17 17
     private EntityManagerInterface $manager,
18 18
     private UserService $service,
19 19
     private HydratorService $hydratorService
20 20
 
21
-  ) {}
21
+    ) {}
22 22
 
23
-  public function __invoke(Request $request)
24
-  {
23
+    public function __invoke(Request $request)
24
+    {
25 25
 
26 26
     try {
27
-      $payload   = json_decode($request->getContent());
28
-      $people =  $this->service->discoveryPeople($payload->email, $payload->name);
27
+        $payload   = json_decode($request->getContent());
28
+        $people =  $this->service->discoveryPeople($payload->email, $payload->name);
29 29
 
30
-      $user = $this->service->getUserSession($this->service->createUser(
30
+        $user = $this->service->getUserSession($this->service->createUser(
31 31
         $people,
32 32
         $payload->email,
33 33
         $payload->password
34
-      ));
34
+        ));
35 35
 
36
-      return new JsonResponse([
36
+        return new JsonResponse([
37 37
         'response' => [
38
-          'data'    => $user,
39
-          'count'   => 1,
40
-          'success' => true,
38
+            'data'    => $user,
39
+            'count'   => 1,
40
+            'success' => true,
41 41
         ],
42
-      ]);
42
+        ]);
43 43
     } catch (\Exception $e) {
44 44
 
45
-      return new JsonResponse([
45
+        return new JsonResponse([
46 46
         'response' => [
47
-          'data'    => [],
48
-          'count'   => 0,
49
-          'error'   => $e->getMessage(),
50
-          'success' => false,
47
+            'data'    => [],
48
+            'count'   => 0,
49
+            'error'   => $e->getMessage(),
50
+            'success' => false,
51 51
         ],
52
-      ], 500);
52
+        ], 500);
53
+    }
53 54
     }
54
-  }
55 55
 }
Please login to merge, or discard this patch.
src/Service/UserService.php 2 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -12,57 +12,57 @@  discard block
 block discarded – undo
12 12
 
13 13
 class UserService
14 14
 {
15
-  public function __construct(
15
+    public function __construct(
16 16
     private EntityManagerInterface $manager,
17 17
     private  UserPasswordEncoderInterface $encoder,
18 18
     private FileService $fileService
19
-  ) {}
20
-  public function changePassword(User $user, $password)
21
-  {
19
+    ) {}
20
+    public function changePassword(User $user, $password)
21
+    {
22 22
     if (!$this->getPermission())
23
-      throw new Exception("You should not pass!!!", 301);
23
+        throw new Exception("You should not pass!!!", 301);
24 24
 
25 25
     $user->setHash(
26
-      $this->encoder->encodePassword($user, $password)
26
+        $this->encoder->encodePassword($user, $password)
27 27
     );
28 28
 
29 29
     $this->manager->persist($user);
30 30
     $this->manager->flush();
31 31
     return $user;
32
-  }
32
+    }
33 33
 
34
-  public function changeApiKey(User $user)
35
-  {
34
+    public function changeApiKey(User $user)
35
+    {
36 36
     if (!$this->getPermission())
37
-      throw new Exception("You should not pass!!!", 301);
37
+        throw new Exception("You should not pass!!!", 301);
38 38
 
39 39
     $user->generateApiKey();
40 40
 
41 41
     $this->manager->persist($user);
42 42
     $this->manager->flush();
43 43
     return $user;
44
-  }
44
+    }
45 45
 
46 46
 
47
-  public function discoveryUser($email, $password, $firstName, $lastName)
48
-  {
47
+    public function discoveryUser($email, $password, $firstName, $lastName)
48
+    {
49 49
 
50 50
     $user = $this->manager->getRepository(User::class)
51
-      ->findOneBy([
51
+        ->findOneBy([
52 52
         'username'       => $email,
53
-      ]);
53
+        ]);
54 54
 
55 55
 
56 56
     $people = $this->discoveryPeople($email, $firstName, $lastName);
57 57
 
58 58
     if (!$user)
59
-      $user = $this->createUser($people, $email, $password);
59
+        $user = $this->createUser($people, $email, $password);
60 60
 
61 61
     return   $user;
62
-  }
62
+    }
63 63
 
64
-  public function getUserSession($user)
65
-  {
64
+    public function getUserSession($user)
65
+    {
66 66
 
67 67
     // get contact data from user
68 68
 
@@ -71,93 +71,93 @@  discard block
 block discarded – undo
71 71
     $number = '';
72 72
 
73 73
     if ($user->getPeople()->getEmail()->count() > 0)
74
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
74
+        $email = $user->getPeople()->getEmail()->first()->getEmail();
75 75
 
76 76
     if ($user->getPeople()->getPhone()->count() > 0) {
77
-      $phone  = $user->getPeople()->getPhone()->first();
78
-      $code   = $phone->getDdd();
79
-      $number = $phone->getPhone();
77
+        $phone  = $user->getPeople()->getPhone()->first();
78
+        $code   = $phone->getDdd();
79
+        $number = $phone->getPhone();
80 80
     }
81 81
 
82 82
     return [
83
-      'id'   => $user->getPeople()->getId(),
84
-      'username' => $user->getUsername(),
85
-      'roles'    => $user->getRoles(),
86
-      'api_key'  => $user->getApiKey(),
87
-      'people'   => $user->getPeople()->getId(),
88
-      'mycompany'  => $this->getCompanyId($user),
89
-      'realname' => $this->getUserRealName($user->getPeople()),
90
-      'avatar'   => $this->fileService->getFileUrl($user->getPeople()),
91
-      'email'    => $email,
92
-      'phone'    => sprintf('%s%s', $code, $number),
93
-      'active'   => (int) $user->getPeople()->getEnabled(),
83
+        'id'   => $user->getPeople()->getId(),
84
+        'username' => $user->getUsername(),
85
+        'roles'    => $user->getRoles(),
86
+        'api_key'  => $user->getApiKey(),
87
+        'people'   => $user->getPeople()->getId(),
88
+        'mycompany'  => $this->getCompanyId($user),
89
+        'realname' => $this->getUserRealName($user->getPeople()),
90
+        'avatar'   => $this->fileService->getFileUrl($user->getPeople()),
91
+        'email'    => $email,
92
+        'phone'    => sprintf('%s%s', $code, $number),
93
+        'active'   => (int) $user->getPeople()->getEnabled(),
94 94
     ];
95
-  }
95
+    }
96 96
 
97
-  private function getUserRealName(People $people): string
98
-  {
97
+    private function getUserRealName(People $people): string
98
+    {
99 99
     $realName = 'John Doe';
100 100
 
101 101
     if ($people->getPeopleType() == 'J')
102
-      $realName = $people->getAlias();
102
+        $realName = $people->getAlias();
103 103
 
104 104
     else {
105
-      if ($people->getPeopleType() == 'F') {
105
+        if ($people->getPeopleType() == 'F') {
106 106
         $realName  = $people->getName();
107 107
         $realName .= ' ' . $people->getAlias();
108 108
         $realName  = trim($realName);
109
-      }
109
+        }
110 110
     }
111 111
 
112 112
     return $realName;
113
-  }
113
+    }
114 114
 
115
-  public function discoveryPeople($mail, $firstName = '', $lastName = '')
116
-  {
115
+    public function discoveryPeople($mail, $firstName = '', $lastName = '')
116
+    {
117 117
     $email = $this->manager->getRepository(Email::class)
118
-      ->findOneBy([
118
+        ->findOneBy([
119 119
         'email'       => $mail,
120
-      ]);
120
+        ]);
121 121
     if ($email) {
122
-      $people = $email->getPeople();
122
+        $people = $email->getPeople();
123 123
     } else {
124
-      $email = new Email();
125
-      $email->setEmail($mail);
126
-      $this->manager->persist($email);
124
+        $email = new Email();
125
+        $email->setEmail($mail);
126
+        $this->manager->persist($email);
127 127
     }
128 128
 
129 129
     if (!$people) {
130 130
 
131
-      $lang = $this->manager->getRepository(Language::class)->findOneBy(['language' => 'pt-BR']);
132
-      $people = new People();
133
-      $people->setAlias($firstName);
134
-      $people->setName($lastName);
135
-      $people->setLanguage($lang);
136
-      //$people->setBilling(0);
137
-      //$people->setBillingDays('daily');
138
-      //$people->setPaymentTerm(1);
139
-      //$people->setIcms(0);
140
-      $email->setPeople($people);
141
-      $this->manager->persist($email);
131
+        $lang = $this->manager->getRepository(Language::class)->findOneBy(['language' => 'pt-BR']);
132
+        $people = new People();
133
+        $people->setAlias($firstName);
134
+        $people->setName($lastName);
135
+        $people->setLanguage($lang);
136
+        //$people->setBilling(0);
137
+        //$people->setBillingDays('daily');
138
+        //$people->setPaymentTerm(1);
139
+        //$people->setIcms(0);
140
+        $email->setPeople($people);
141
+        $this->manager->persist($email);
142 142
     }
143 143
 
144 144
     $this->manager->persist($people);
145 145
     $this->manager->flush();
146 146
     return $people;
147
-  }
147
+    }
148 148
 
149
-  public function createUser(People $people, $username, $password)
150
-  {
149
+    public function createUser(People $people, $username, $password)
150
+    {
151 151
     if (!$this->getPermission())
152
-      throw new Exception("You should not pass!!!", 301);
152
+        throw new Exception("You should not pass!!!", 301);
153 153
 
154 154
     $user = $this->manager->getRepository(User::class)
155
-      ->findOneBy([
155
+        ->findOneBy([
156 156
         'username'       => $username,
157
-      ]);
157
+        ]);
158 158
 
159 159
     if ($user)
160
-      throw new Exception("User already exists", 301);
160
+        throw new Exception("User already exists", 301);
161 161
 
162 162
     $user = new User();
163 163
     $user->setPeople($people);
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
     $this->manager->persist($user);
168 168
     $this->manager->flush();
169 169
     return $user;
170
-  }
170
+    }
171 171
 
172 172
 
173
-  public function getCompany(User $user)
174
-  {
173
+    public function getCompany(User $user)
174
+    {
175 175
     $peopleLink = $user->getPeople()->getLink()->first();
176 176
 
177 177
     if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
178
-      return $peopleLink->getCompany();
179
-  }
178
+        return $peopleLink->getCompany();
179
+    }
180 180
 
181
-  public function getCompanyId(User $user)
182
-  {
181
+    public function getCompanyId(User $user)
182
+    {
183 183
     $company = $this->getCompany($user);
184 184
     return $company ? $company->getId() : null;
185
-  }
185
+    }
186 186
 
187
-  /**
188
-   * @todo arrumar 
189
-   */
190
-  private function getPermission()
191
-  {
187
+    /**
188
+     * @todo arrumar 
189
+     */
190
+    private function getPermission()
191
+    {
192 192
     return true;
193
-  }
193
+    }
194 194
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
   ) {}
20 20
   public function changePassword(User $user, $password)
21 21
   {
22
-    if (!$this->getPermission())
23
-      throw new Exception("You should not pass!!!", 301);
22
+    if (!$this->getPermission()) {
23
+          throw new Exception("You should not pass!!!", 301);
24
+    }
24 25
 
25 26
     $user->setHash(
26 27
       $this->encoder->encodePassword($user, $password)
@@ -33,8 +34,9 @@  discard block
 block discarded – undo
33 34
 
34 35
   public function changeApiKey(User $user)
35 36
   {
36
-    if (!$this->getPermission())
37
-      throw new Exception("You should not pass!!!", 301);
37
+    if (!$this->getPermission()) {
38
+          throw new Exception("You should not pass!!!", 301);
39
+    }
38 40
 
39 41
     $user->generateApiKey();
40 42
 
@@ -55,8 +57,9 @@  discard block
 block discarded – undo
55 57
 
56 58
     $people = $this->discoveryPeople($email, $firstName, $lastName);
57 59
 
58
-    if (!$user)
59
-      $user = $this->createUser($people, $email, $password);
60
+    if (!$user) {
61
+          $user = $this->createUser($people, $email, $password);
62
+    }
60 63
 
61 64
     return   $user;
62 65
   }
@@ -70,8 +73,9 @@  discard block
 block discarded – undo
70 73
     $code   = '';
71 74
     $number = '';
72 75
 
73
-    if ($user->getPeople()->getEmail()->count() > 0)
74
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
76
+    if ($user->getPeople()->getEmail()->count() > 0) {
77
+          $email = $user->getPeople()->getEmail()->first()->getEmail();
78
+    }
75 79
 
76 80
     if ($user->getPeople()->getPhone()->count() > 0) {
77 81
       $phone  = $user->getPeople()->getPhone()->first();
@@ -98,10 +102,9 @@  discard block
 block discarded – undo
98 102
   {
99 103
     $realName = 'John Doe';
100 104
 
101
-    if ($people->getPeopleType() == 'J')
102
-      $realName = $people->getAlias();
103
-
104
-    else {
105
+    if ($people->getPeopleType() == 'J') {
106
+          $realName = $people->getAlias();
107
+    } else {
105 108
       if ($people->getPeopleType() == 'F') {
106 109
         $realName  = $people->getName();
107 110
         $realName .= ' ' . $people->getAlias();
@@ -148,16 +151,18 @@  discard block
 block discarded – undo
148 151
 
149 152
   public function createUser(People $people, $username, $password)
150 153
   {
151
-    if (!$this->getPermission())
152
-      throw new Exception("You should not pass!!!", 301);
154
+    if (!$this->getPermission()) {
155
+          throw new Exception("You should not pass!!!", 301);
156
+    }
153 157
 
154 158
     $user = $this->manager->getRepository(User::class)
155 159
       ->findOneBy([
156 160
         'username'       => $username,
157 161
       ]);
158 162
 
159
-    if ($user)
160
-      throw new Exception("User already exists", 301);
163
+    if ($user) {
164
+          throw new Exception("User already exists", 301);
165
+    }
161 166
 
162 167
     $user = new User();
163 168
     $user->setPeople($people);
@@ -174,8 +179,9 @@  discard block
 block discarded – undo
174 179
   {
175 180
     $peopleLink = $user->getPeople()->getLink()->first();
176 181
 
177
-    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
178
-      return $peopleLink->getCompany();
182
+    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) {
183
+          return $peopleLink->getCompany();
184
+    }
179 185
   }
180 186
 
181 187
   public function getCompanyId(User $user)
Please login to merge, or discard this patch.