Passed
Push — master ( 9f430e...5248ed )
by Luiz Kim
02:41 queued 15s
created
src/Controller/AddDeviceConfigAction.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@
 block discarded – undo
14 14
 
15 15
 class AddDeviceConfigAction
16 16
 {
17
-  public function __construct(
17
+    public function __construct(
18 18
     private EntityManagerInterface $manager,
19 19
     private HydratorService $hydratorService,
20 20
     private DeviceService $deviceService
21
-  ) {}
21
+    ) {}
22 22
 
23
-  public function __invoke(Request $request): JsonResponse
24
-  {
23
+    public function __invoke(Request $request): JsonResponse
24
+    {
25 25
     try {
26
-      $json = json_decode($request->getContent(), true);
27
-      $device = $request->headers->get('device');
28
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
29
-      $configs = json_decode($json['configs'], true);
30
-      $device_config = $this->deviceService->addDeviceConfigs($people, $configs, $device);
31
-      return new JsonResponse($this->hydratorService->item(DeviceConfig::class, $device_config->getId(), 'device_config:read'), Response::HTTP_OK);
26
+        $json = json_decode($request->getContent(), true);
27
+        $device = $request->headers->get('device');
28
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
29
+        $configs = json_decode($json['configs'], true);
30
+        $device_config = $this->deviceService->addDeviceConfigs($people, $configs, $device);
31
+        return new JsonResponse($this->hydratorService->item(DeviceConfig::class, $device_config->getId(), 'device_config:read'), Response::HTTP_OK);
32 32
     } catch (Exception $e) {
33
-      return new JsonResponse($this->hydratorService->error($e));
33
+        return new JsonResponse($this->hydratorService->error($e));
34
+    }
34 35
     }
35
-  }
36 36
 }
Please login to merge, or discard this patch.
src/Service/DeviceService.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@
 block discarded – undo
51 51
     {
52 52
         $device = $this->discoveryDevice($deviceId);
53 53
 
54
-        $device_config = $this->discoveryDeviceConfig($device,  $people);
54
+        $device_config = $this->discoveryDeviceConfig($device, $people);
55 55
         foreach ($configs as $key => $config)
56
-            $device_config->addConfig($key,  $config);
56
+            $device_config->addConfig($key, $config);
57 57
 
58 58
         $this->manager->persist($device_config);
59 59
         $this->manager->flush();
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@
 block discarded – undo
52 52
         $device = $this->discoveryDevice($deviceId);
53 53
 
54 54
         $device_config = $this->discoveryDeviceConfig($device,  $people);
55
-        foreach ($configs as $key => $config)
56
-            $device_config->addConfig($key,  $config);
55
+        foreach ($configs as $key => $config) {
56
+                    $device_config->addConfig($key,  $config);
57
+        }
57 58
 
58 59
         $this->manager->persist($device_config);
59 60
         $this->manager->flush();
Please login to merge, or discard this patch.
src/Service/ExtraDataService.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function discoveryDevice(&$entity)
37 37
     {
38
-        if ($entity instanceof Device || $entity instanceof DeviceConfig)
39
-            return;
38
+        if ($entity instanceof Device || $entity instanceof DeviceConfig) {
39
+                    return;
40
+        }
40 41
 
41 42
         $deviceId = $this->request->headers->get('DEVICE') ?: $this->getUserIp();
42 43
         if (method_exists($entity, 'setDevice')) {
@@ -47,14 +48,16 @@  discard block
 block discarded – undo
47 48
 
48 49
     public function discoveryUser(&$entity)
49 50
     {
50
-        if (method_exists($entity, 'setUser'))
51
-            $entity->setUser($this->security->getUser());
51
+        if (method_exists($entity, 'setUser')) {
52
+                    $entity->setUser($this->security->getUser());
53
+        }
52 54
     }
53 55
 
54 56
     public function persist(&$entity)
55 57
     {
56
-        if (self::$persisted == true)
57
-            return;
58
+        if (self::$persisted == true) {
59
+                    return;
60
+        }
58 61
         self::$persisted = true;
59 62
 
60 63
         //$this->manager->persist($entity);
@@ -72,15 +75,17 @@  discard block
 block discarded – undo
72 75
         } else {
73 76
             $json =       json_decode($this->request->getContent(), true);
74 77
             $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null;
75
-            if (!$extra_data)
76
-                return;
78
+            if (!$extra_data) {
79
+                            return;
80
+            }
77 81
             $entity_id = $extra_data['entity_id'];
78 82
             $entity_name = $extra_data['entity_name'];
79 83
         }
80 84
 
81 85
 
82
-        if (!$entity_id || !$entity_name)
83
-            return;
86
+        if (!$entity_id || !$entity_name) {
87
+                    return;
88
+        }
84 89
 
85 90
         foreach ($extra_data['data'] as $key => $data) {
86 91
             $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key);
@@ -91,8 +96,9 @@  discard block
 block discarded – undo
91 96
                 'extra_fields' => $extra_fields
92 97
             ]);
93 98
 
94
-            if (!$extraData)
95
-                $extraData = new ExtraData();
99
+            if (!$extraData) {
100
+                            $extraData = new ExtraData();
101
+            }
96 102
 
97 103
             $extraData->setExtraFields($extra_fields);
98 104
             $extraData->setEntityName($entity_name);
Please login to merge, or discard this patch.
src/Service/ConfigService.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
     public function getConfig(People $people, $key, $json = false)
20 20
     {
21 21
         $config = $this->discoveryConfig($people, $key, false);
22
-        $value =  $config ? $config->getConfigValue() : null;
22
+        $value = $config ? $config->getConfigValue() : null;
23 23
         return $json ? json_decode($value, true) : $value;
24 24
     }
25 25
 
26 26
     private function discoveryConfig(People $people, $key, $create = true): ?Config
27 27
     {
28
-        $config =   $this->manager->getRepository(Config::class)->findOneBy([
28
+        $config = $this->manager->getRepository(Config::class)->findOneBy([
29 29
             'people' => $people,
30 30
             'configKey' => $key
31 31
         ]);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     private function discoveryInfinitePayWallet(People $company)
151 151
     {
152
-        $paymentTypes =  [
152
+        $paymentTypes = [
153 153
             [
154 154
                 'paymentType' => 'Débito',
155 155
                 'frequency' => 'single',
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
             'people' => $people,
30 30
             'configKey' => $key
31 31
         ]);
32
-        if ($config)
33
-            return $config;
32
+        if ($config) {
33
+                    return $config;
34
+        }
34 35
         if ($create) {
35 36
             $config = new Config();
36 37
             $config->setConfigKey($key);
@@ -108,12 +109,13 @@  discard block
 block discarded – undo
108 109
             'private'
109 110
         );
110 111
 
111
-        foreach ($paymentTypes as $paymentType)
112
-            $this->walletService->discoverWalletPaymentType(
112
+        foreach ($paymentTypes as $paymentType) {
113
+                    $this->walletService->discoverWalletPaymentType(
113 114
                 $wallet,
114 115
                 $this->walletService->discoverPaymentType($company, $paymentType),
115 116
                 $paymentType['paymentCode']
116 117
             );
118
+        }
117 119
     }
118 120
 
119 121
     private function discoveryWithdrawlWallet(People $company)
@@ -139,12 +141,13 @@  discard block
 block discarded – undo
139 141
             $module,
140 142
             'private'
141 143
         );
142
-        foreach ($paymentTypes as $paymentType)
143
-            $this->walletService->discoverWalletPaymentType(
144
+        foreach ($paymentTypes as $paymentType) {
145
+                    $this->walletService->discoverWalletPaymentType(
144 146
                 $wallet,
145 147
                 $this->walletService->discoverPaymentType($company, $paymentType),
146 148
                 $paymentType['paymentCode']
147 149
             );
150
+        }
148 151
     }
149 152
 
150 153
     private function discoveryInfinitePayWallet(People $company)
@@ -184,12 +187,13 @@  discard block
 block discarded – undo
184 187
             'private'
185 188
         );
186 189
 
187
-        foreach ($paymentTypes as $paymentType)
188
-            $this->walletService->discoverWalletPaymentType(
190
+        foreach ($paymentTypes as $paymentType) {
191
+                    $this->walletService->discoverWalletPaymentType(
189 192
                 $wallet,
190 193
                 $this->walletService->discoverPaymentType($company, $paymentType),
191 194
                 $paymentType['paymentCode']
192 195
             );
196
+        }
193 197
     }
194 198
 
195 199
     private function discoveryCieloWallet(People $company)
@@ -261,11 +265,12 @@  discard block
 block discarded – undo
261 265
             'private'
262 266
         );
263 267
 
264
-        foreach ($paymentTypes as $paymentType)
265
-            $this->walletService->discoverWalletPaymentType(
268
+        foreach ($paymentTypes as $paymentType) {
269
+                    $this->walletService->discoverWalletPaymentType(
266 270
                 $wallet,
267 271
                 $this->walletService->discoverPaymentType($company, $paymentType),
268 272
                 $paymentType['paymentCode']
269 273
             );
274
+        }
270 275
     }
271 276
 }
Please login to merge, or discard this patch.