Passed
Push — master ( c97c4f...cfd6ca )
by Luiz Kim
02:17
created
src/Service/PeopleService.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     private Security               $security,
28 28
     private RequestStack $requestStack,
29 29
   ) {
30
-    $this->request  = $requestStack->getCurrentRequest();
30
+    $this->request = $requestStack->getCurrentRequest();
31 31
   }
32 32
 
33 33
   public function prePersist(People $people)
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     $phone = $this->getPhone($phone_number['ddd'], $phone_number['phone']);
79 79
     if ($phone && $phone->getPeople()) {
80 80
       if ($phone->getPeople()->getId() != $people->getId())
81
-        throw new Exception("Phone is in use by people " . $people->getId(), 1);
81
+        throw new Exception("Phone is in use by people ".$people->getId(), 1);
82 82
     } else {
83 83
       $phone = new Phone();
84 84
       $phone->setDdd($phone_number['ddd']);
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     $document = $this->getDocument($document_number, $document_type);
96 96
     if ($document) {
97 97
       if ($document->getPeople()->getId() != $people->getId())
98
-        throw new Exception("Document is in use by people " . $people->getId(), 1);
98
+        throw new Exception("Document is in use by people ".$people->getId(), 1);
99 99
     } else {
100 100
       $document = new Document();
101 101
       $document->setDocument($document_number);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     $email = $this->getEmail($email_str);
114 114
     if ($email && $email->getPeople()) {
115 115
       if ($email->getPeople()->getId() != $people->getId())
116
-        throw new Exception("Email is in use by people " . $people->getId(), 1);
116
+        throw new Exception("Email is in use by people ".$people->getId(), 1);
117 117
     } else {
118 118
       $email = new Email();
119 119
       $email->setEmail($email_str);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
   public function discoveryDocumentType(string $document_type): DocumentType
140 140
   {
141
-    $documentType =  $this->manager->getRepository(DocumentType::class)->findOneBy(['document_type' => $document_type]);
141
+    $documentType = $this->manager->getRepository(DocumentType::class)->findOneBy(['document_type' => $document_type]);
142 142
 
143 143
     if (!$documentType) {
144 144
       $documentType = new DocumentType();
@@ -222,29 +222,29 @@  discard block
 block discarded – undo
222 222
   public function checkLink(QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void
223 223
   {
224 224
 
225
-    $link   = $this->request->query->get('link',   null);
225
+    $link = $this->request->query->get('link', null);
226 226
     $company = $this->request->query->get('company', null);
227 227
     $link_type = $this->request->query->get('link_type', null);
228 228
 
229 229
     if ($link_type) {
230
-      $queryBuilder->join(sprintf('%s.' . ($link ? 'company' : 'link'), $rootAlias), 'PeopleLink');
230
+      $queryBuilder->join(sprintf('%s.'.($link ? 'company' : 'link'), $rootAlias), 'PeopleLink');
231 231
       $queryBuilder->andWhere('PeopleLink.link_type IN(:link_type)');
232 232
       $queryBuilder->setParameter('link_type', $link_type);
233 233
     }
234 234
 
235 235
     if ($company || $link) {
236
-      $queryBuilder->andWhere('PeopleLink.' . ($link ? 'people' : 'company') . ' IN(:people)');
236
+      $queryBuilder->andWhere('PeopleLink.'.($link ? 'people' : 'company').' IN(:people)');
237 237
       $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", ($link ?: $company)));
238 238
     }
239 239
   }
240 240
   public function checkCompany($type, QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void
241 241
   {
242
-    $companies   = $this->getMyCompanies();
243
-    $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:companies)', $rootAlias, $rootAlias));
242
+    $companies = $this->getMyCompanies();
243
+    $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:companies)', $rootAlias, $rootAlias));
244 244
     $queryBuilder->setParameter('companies', $companies);
245 245
 
246 246
     if ($payer = $this->request->query->get('company', null)) {
247
-      $queryBuilder->andWhere(sprintf('%s.' . $type . ' IN(:people)', $rootAlias));
247
+      $queryBuilder->andWhere(sprintf('%s.'.$type.' IN(:people)', $rootAlias));
248 248
       $queryBuilder->setParameter('people', preg_replace("/[^0-9]/", "", $payer));
249 249
     }
250 250
   }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      */
257 257
     $token = $this->security->getToken();
258 258
     if (!$token) return [];
259
-    $currentUser  =  $token->getUser();
259
+    $currentUser  = $token->getUser();
260 260
     $companies    = [];
261 261
     if (!$currentUser) return [];
262 262
 
Please login to merge, or discard this patch.