Passed
Push — master ( b633b9...638f09 )
by Luiz Kim
12:22 queued 09:56
created
src/Controller/DeleteUserAction.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@
 block discarded – undo
113 113
 
114 114
             return true;
115 115
         } catch (\Exception $e) {
116
-            if ($this->manager->getConnection()->isTransactionActive())
117
-                $this->manager->getConnection()->rollBack();
116
+            if ($this->manager->getConnection()->isTransactionActive()) {
117
+                            $this->manager->getConnection()->rollBack();
118
+            }
118 119
 
119 120
             throw new \InvalidArgumentException($e->getMessage());
120 121
         }
Please login to merge, or discard this patch.
src/Repository/PeopleRepository.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
             ->setParameter('company', $company->getId())
52 52
             ->setParameter('people', $people->getId());
53 53
 
54
-        if ($linkType)
55
-            $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType');
54
+        if ($linkType) {
55
+                    $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType');
56
+        }
56 57
 
57 58
         if ($maxResults) {
58 59
             $queryBuilder->setMaxResults($maxResults);
Please login to merge, or discard this patch.
src/Service/PeopleRoleService.php 1 patch
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
      */
38 38
     foreach ($getPeopleCompanies as $peopleCompany) {
39 39
       $isFranchisee = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'franchisee', 1);
40
-      if ($isFranchisee) return true;
40
+      if ($isFranchisee) {
41
+       return true;
42
+      }
41 43
     }
42 44
     return $isFranchisee;
43 45
   }
@@ -54,7 +56,9 @@  discard block
 block discarded – undo
54 56
     $isSalesman = false;
55 57
 
56 58
     $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1);
57
-    if ($isSalesman) return true;
59
+    if ($isSalesman) {
60
+     return true;
61
+    }
58 62
 
59 63
     $getPeopleCompanies = $this->manager->getRepository(PeopleLink::class)->findBy([
60 64
       'people' => $people,
@@ -65,7 +69,9 @@  discard block
 block discarded – undo
65 69
      */
66 70
     foreach ($getPeopleCompanies as $peopleCompany) {
67 71
       $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $peopleCompany->getCompany(), 'salesman', 1);
68
-      if ($isSalesman) return true;
72
+      if ($isSalesman) {
73
+       return true;
74
+      }
69 75
     }
70 76
     return $isSalesman;
71 77
   }
@@ -78,8 +84,9 @@  discard block
 block discarded – undo
78 84
     $mainCompany = $this->getMainCompany();
79 85
 
80 86
     $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1);
81
-    if ($isSuper)
82
-      $peopleRole[] = 'super';
87
+    if ($isSuper) {
88
+          $peopleRole[] = 'super';
89
+    }
83 90
 
84 91
 
85 92
 
@@ -90,13 +97,15 @@  discard block
 block discarded – undo
90 97
     }
91 98
 
92 99
     $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1);
93
-    if ($isClient)
94
-      $peopleRole[] = 'client';
100
+    if ($isClient) {
101
+          $peopleRole[] = 'client';
102
+    }
95 103
 
96 104
 
97 105
     $isSalesman = $this->isSalesman($user);
98
-    if ($isSalesman)
99
-      $peopleRole[] = 'salesman';
106
+    if ($isSalesman) {
107
+          $peopleRole[] = 'salesman';
108
+    }
100 109
 
101 110
 
102 111
     return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole));
@@ -110,15 +119,18 @@  discard block
 block discarded – undo
110 119
   public function getMainCompany(): People
111 120
   {
112 121
 
113
-    if (self::$mainCompany) return self::$mainCompany;
122
+    if (self::$mainCompany) {
123
+     return self::$mainCompany;
124
+    }
114 125
     
115 126
     $domain  = $this->domainService->getMainDomain();
116 127
     $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]);
117 128
 
118
-    if ($company === null)
119
-      throw new \Exception(
129
+    if ($company === null) {
130
+          throw new \Exception(
120 131
         sprintf('Main company "%s" not found', $domain)
121 132
       );
133
+    }
122 134
 
123 135
     self::$mainCompany =  $company->getPeople();
124 136
     return self::$mainCompany;
Please login to merge, or discard this patch.
src/Controller/GetMyCompaniesAction.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,12 +261,13 @@
 block discarded – undo
261 261
 
262 262
   private function getLogo(People $company): ?array
263 263
   {
264
-    if ($company->getImage() instanceof File)
265
-      return [
264
+    if ($company->getImage() instanceof File) {
265
+          return [
266 266
         'id'     => $company->getImage()->getId(),
267 267
         'domain' => $this->domainService->getMainDomain(),
268 268
         'url'    => '/files/' . $company->getImage()->getId() . '/download'
269 269
       ];
270
+    }
270 271
 
271 272
     return null;
272 273
   }
Please login to merge, or discard this patch.
src/Service/PeopleService.php 1 patch
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     $payload   = json_decode($request->getContent());
34 34
     if (isset($payload->link_type)) {
35 35
       $company = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->company));
36
-      if ($company)
37
-        $this->addLink($company, $people, $payload->link_type);
38
-      else {
36
+      if ($company) {
37
+              $this->addLink($company, $people, $payload->link_type);
38
+      } else {
39 39
         $link = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->link));
40 40
         if ($payload->link_type == 'employee' && $link) {
41 41
           $this->addLink($people, $link, $payload->link_type);
@@ -63,8 +63,9 @@  discard block
 block discarded – undo
63 63
       'link_type' => $link_type
64 64
     ]);
65 65
 
66
-    if (!$peopleLink)
67
-      $peopleLink = new PeopleLink();
66
+    if (!$peopleLink) {
67
+          $peopleLink = new PeopleLink();
68
+    }
68 69
 
69 70
     $peopleLink->setCompany($company);
70 71
     $peopleLink->setPeople($people);
Please login to merge, or discard this patch.