@@ -125,15 +125,16 @@ |
||
125 | 125 | |
126 | 126 | private function log() |
127 | 127 | { |
128 | - if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario') |
|
129 | - $this->user = $this->entity; |
|
130 | - else |
|
131 | - $this->log[] = |
|
128 | + if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario') { |
|
129 | + $this->user = $this->entity; |
|
130 | + } else { |
|
131 | + $this->log[] = |
|
132 | 132 | [ |
133 | 133 | 'action' => $this->action, |
134 | 134 | 'class' => str_replace('Proxies\\__CG__\\', '', get_class($this->entity)), |
135 | 135 | 'object' => $this->getObject($this->entity) |
136 | 136 | ]; |
137 | + } |
|
137 | 138 | } |
138 | 139 | |
139 | 140 | private function getObject($entity) |
@@ -89,11 +89,13 @@ |
||
89 | 89 | private function getMembers($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = []) |
90 | 90 | { |
91 | 91 | |
92 | - if ($limit < 1) |
|
93 | - $limit = $this->request->get('itemsPerPage') ?: 50; |
|
92 | + if ($limit < 1) { |
|
93 | + $limit = $this->request->get('itemsPerPage') ?: 50; |
|
94 | + } |
|
94 | 95 | |
95 | - if ($page == 1) |
|
96 | - $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
96 | + if ($page == 1) { |
|
97 | + $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; |
|
98 | + } |
|
97 | 99 | |
98 | 100 | $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); |
99 | 101 |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | ->getResult() |
44 | 44 | ; |
45 | 45 | |
46 | - if (empty($result)) |
|
47 | - return null; |
|
46 | + if (empty($result)) { |
|
47 | + return null; |
|
48 | + } |
|
48 | 49 | |
49 | 50 | return $result[0]; |
50 | 51 | } |
@@ -78,8 +79,9 @@ discard block |
||
78 | 79 | ->getResult() |
79 | 80 | ; |
80 | 81 | |
81 | - if (empty($result)) |
|
82 | - return null; |
|
82 | + if (empty($result)) { |
|
83 | + return null; |
|
84 | + } |
|
83 | 85 | |
84 | 86 | return $result[0]; |
85 | 87 | } |
@@ -56,15 +56,17 @@ |
||
56 | 56 | |
57 | 57 | $company = $request->query->get('myCompany', null); |
58 | 58 | |
59 | - if ($company === null) |
|
60 | - throw new Exception("Company not found", 404); |
|
59 | + if ($company === null) { |
|
60 | + throw new Exception("Company not found", 404); |
|
61 | + } |
|
61 | 62 | |
62 | 63 | |
63 | 64 | $myCompany = $this->manager->getRepository(People::class) |
64 | 65 | ->find($company); |
65 | 66 | |
66 | - if ($myCompany === null) |
|
67 | - throw new Exception("Company not found", 404); |
|
67 | + if ($myCompany === null) { |
|
68 | + throw new Exception("Company not found", 404); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | |
70 | 72 |
@@ -56,15 +56,17 @@ |
||
56 | 56 | |
57 | 57 | $company = $request->query->get('myCompany', null); |
58 | 58 | |
59 | - if ($company === null) |
|
60 | - throw new Exception("Company not found", 404); |
|
59 | + if ($company === null) { |
|
60 | + throw new Exception("Company not found", 404); |
|
61 | + } |
|
61 | 62 | |
62 | 63 | |
63 | 64 | $myCompany = $this->manager->getRepository(People::class) |
64 | 65 | ->find($company); |
65 | 66 | |
66 | - if ($myCompany === null) |
|
67 | - throw new Exception("Company not found", 404); |
|
67 | + if ($myCompany === null) { |
|
68 | + throw new Exception("Company not found", 404); |
|
69 | + } |
|
68 | 70 | |
69 | 71 | |
70 | 72 |
@@ -64,8 +64,9 @@ discard block |
||
64 | 64 | ->getQuery() |
65 | 65 | ->getResult(); |
66 | 66 | |
67 | - if (empty($result)) |
|
68 | - return null; |
|
67 | + if (empty($result)) { |
|
68 | + return null; |
|
69 | + } |
|
69 | 70 | |
70 | 71 | $configs = []; |
71 | 72 | |
@@ -88,8 +89,9 @@ discard block |
||
88 | 89 | ]); |
89 | 90 | |
90 | 91 | |
91 | - if (empty($config) || $config->getConfigValue() != 'itau') |
|
92 | - return null; |
|
92 | + if (empty($config) || $config->getConfigValue() != 'itau') { |
|
93 | + return null; |
|
94 | + } |
|
93 | 95 | |
94 | 96 | $result = $this->createQueryBuilder('a') |
95 | 97 | ->andWhere('a.people = :people') |
@@ -99,8 +101,9 @@ discard block |
||
99 | 101 | ->getQuery() |
100 | 102 | ->getResult(); |
101 | 103 | |
102 | - if (empty($result)) |
|
103 | - return null; |
|
104 | + if (empty($result)) { |
|
105 | + return null; |
|
106 | + } |
|
104 | 107 | |
105 | 108 | $configs = []; |
106 | 109 | |
@@ -125,8 +128,9 @@ discard block |
||
125 | 128 | ->getQuery() |
126 | 129 | ->getResult(); |
127 | 130 | |
128 | - if (empty($result)) |
|
129 | - return null; |
|
131 | + if (empty($result)) { |
|
132 | + return null; |
|
133 | + } |
|
130 | 134 | |
131 | 135 | $configs = []; |
132 | 136 |
@@ -846,8 +846,9 @@ |
||
846 | 846 | |
847 | 847 | protected function getPeopleAddress(People $people): ?array |
848 | 848 | { |
849 | - if (($address = $people->getAddress()->first()) === false) |
|
850 | - return null; |
|
849 | + if (($address = $people->getAddress()->first()) === false) { |
|
850 | + return null; |
|
851 | + } |
|
851 | 852 | |
852 | 853 | return $this->getAddress($address); |
853 | 854 | } |
@@ -19,12 +19,13 @@ |
||
19 | 19 | |
20 | 20 | public function getFileUrl(People $people): ?array |
21 | 21 | { |
22 | - if ($people->getImage() instanceof File) |
|
23 | - return [ |
|
22 | + if ($people->getImage() instanceof File) { |
|
23 | + return [ |
|
24 | 24 | 'id' => $people->getImage()->getId(), |
25 | 25 | 'domain' => $this->domainService->getMainDomain(), |
26 | 26 | 'url' => '/files/' . $people->getImage()->getId() . '/download' |
27 | 27 | ]; |
28 | + } |
|
28 | 29 | |
29 | 30 | return null; |
30 | 31 | } |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | ) |
44 | 44 | )); |
45 | 45 | |
46 | - if (!$domain) |
|
47 | - throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
46 | + if (!$domain) { |
|
47 | + throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
48 | + } |
|
48 | 49 | return $domain; |
49 | 50 | } |
50 | 51 | |
@@ -55,7 +56,9 @@ discard block |
||
55 | 56 | |
56 | 57 | public function getPeopleDomain(): PeopleDomain |
57 | 58 | { |
58 | - if (self::$peopleDomain) return self::$peopleDomain; |
|
59 | + if (self::$peopleDomain) { |
|
60 | + return self::$peopleDomain; |
|
61 | + } |
|
59 | 62 | |
60 | 63 | $domain = $this->getDomain(); |
61 | 64 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
@@ -65,10 +68,11 @@ discard block |
||
65 | 68 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
66 | 69 | } |
67 | 70 | |
68 | - if (self::$peopleDomain === null) |
|
69 | - throw new \Exception( |
|
71 | + if (self::$peopleDomain === null) { |
|
72 | + throw new \Exception( |
|
70 | 73 | sprintf('Main company "%s" not found', $domain) |
71 | 74 | ); |
75 | + } |
|
72 | 76 | |
73 | 77 | return self::$peopleDomain; |
74 | 78 | } |