@@ -120,7 +120,7 @@ |
||
120 | 120 | sprintf('Main company "%s" not found', $domain) |
121 | 121 | ); |
122 | 122 | |
123 | - self::$mainCompany = $company->getPeople(); |
|
123 | + self::$mainCompany = $company->getPeople(); |
|
124 | 124 | return self::$mainCompany; |
125 | 125 | } |
126 | 126 | } |
@@ -37,7 +37,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |