Passed
Push — master ( 9f430e...5248ed )
by Luiz Kim
02:41 queued 15s
created
src/Service/NotificationService.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@
 block discarded – undo
10 10
 class NotificationService
11 11
 {
12 12
 
13
-  public function __construct(
13
+    public function __construct(
14 14
     private EntityManagerInterface $manager,
15 15
     private Security               $security,
16 16
     private RequestStack $requestStack,
17 17
     private PusherService $pusher
18
-  ) {
19
-  }
18
+    ) {
19
+    }
20 20
 
21
-  public function postPersist(Notification $notification)
22
-  {
21
+    public function postPersist(Notification $notification)
22
+    {
23 23
     $this->pusher->push(['company' => 1, 'people' => 1], 'my_topic');
24
-  }
24
+    }
25 25
 }
Please login to merge, or discard this patch.
src/Service/ExtraDataService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 
65 65
             //$this->manager->persist($entity);
66 66
         } else {
67
-            $json =       json_decode($this->request->getContent(), true);
67
+            $json = json_decode($this->request->getContent(), true);
68 68
             $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null;
69 69
             if (!$extra_data)
70 70
                 return;
Please login to merge, or discard this 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/Repository/ModuleRepository.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
  */
15 15
 class ModuleRepository extends ServiceEntityRepository
16 16
 {
17
-  public function __construct(ManagerRegistry $registry)
18
-  {
17
+    public function __construct(ManagerRegistry $registry)
18
+    {
19 19
     parent::__construct($registry, Module::class);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
src/Controller/AddAppConfigAction.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,31 +18,31 @@
 block discarded – undo
18 18
 
19 19
 class AddAppConfigAction
20 20
 {
21
-  public function __construct(
21
+    public function __construct(
22 22
     private Security $security,
23 23
     private EntityManagerInterface $manager,
24 24
     private ConfigService $configService,
25 25
     private HydratorService $hydratorService
26
-  ) {}
26
+    ) {}
27 27
 
28
-  public function __invoke(Request $request): JsonResponse
29
-  {
28
+    public function __invoke(Request $request): JsonResponse
29
+    {
30 30
     try {
31
-      $json = json_decode($request->getContent(), true);
32
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
33
-      $module = $this->manager->getRepository(Module::class)->find(preg_replace("/[^0-9]/", "", $json['module']));
34
-      $configValue = json_decode($json['configValue'], true);
35
-      $config = $this->configService->addConfig(
31
+        $json = json_decode($request->getContent(), true);
32
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
33
+        $module = $this->manager->getRepository(Module::class)->find(preg_replace("/[^0-9]/", "", $json['module']));
34
+        $configValue = json_decode($json['configValue'], true);
35
+        $config = $this->configService->addConfig(
36 36
         $people,
37 37
         $json['configKey'],
38 38
         $configValue,
39 39
         $module,
40 40
         $json['visibility']
41
-      );
41
+        );
42 42
 
43
-      return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK);
43
+        return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK);
44 44
     } catch (Exception $e) {
45
-      return new JsonResponse($this->hydratorService->error($e));
45
+        return new JsonResponse($this->hydratorService->error($e));
46
+    }
46 47
     }
47
-  }
48 48
 }
Please login to merge, or discard this patch.
src/Listener/DefaultEventListener.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
             if (method_exists($service, $method)) {
55 55
                 $newEntity = $service->$method($entity);
56 56
 
57
-                if ('postPersist' === $method && $newEntity)
58
-                    $this->manager->refresh($newEntity);
57
+                if ('postPersist' === $method && $newEntity) {
58
+                                    $this->manager->refresh($newEntity);
59
+                }
59 60
             }
60 61
         }
61 62
         return $entity;
Please login to merge, or discard this patch.
src/Service/PrintService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     public function addLine($prefix = '', $suffix = '', $delimiter = ' ')
21 21
     {
22 22
         $initialSpace = str_repeat(" ", $this->initialSpace);
23
-        $count =   $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix);
23
+        $count = $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix);
24 24
         if ($count > 0)
25 25
             $delimiter = str_repeat($delimiter, $count);
26 26
         $this->text .= $initialSpace . $prefix . $delimiter . $suffix . "\n";
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@
 block discarded – undo
21 21
     {
22 22
         $initialSpace = str_repeat(" ", $this->initialSpace);
23 23
         $count =   $this->totalChars - $this->initialSpace - strlen($prefix) - strlen($suffix);
24
-        if ($count > 0)
25
-            $delimiter = str_repeat($delimiter, $count);
24
+        if ($count > 0) {
25
+                    $delimiter = str_repeat($delimiter, $count);
26
+        }
26 27
         $this->text .= $initialSpace . $prefix . $delimiter . $suffix . "\n";
27 28
     }
28 29
 
Please login to merge, or discard this patch.
src/Controller/DiscoveryMainConfigsAction.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@
 block discarded – undo
13 13
 
14 14
 class DiscoveryMainConfigsAction
15 15
 {
16
-  public function __construct(
16
+    public function __construct(
17 17
     private EntityManagerInterface $manager,
18 18
     private HydratorService $hydratorService,
19 19
     private ConfigService $configService
20
-  ) {}
20
+    ) {}
21 21
 
22
-  public function __invoke(Request $request): JsonResponse
23
-  {
22
+    public function __invoke(Request $request): JsonResponse
23
+    {
24 24
     try {
25
-      $json = json_decode($request->getContent(), true);
26
-      $device = $this->manager->getRepository(People::class)->findOneBy(['device' => $request->headers->get('device')]);
27
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
28
-      $configs = $this->configService->discoveryMainConfigs($people, $device);
29
-      return new JsonResponse($this->hydratorService->collectionData($configs, Config::class, 'config:read'));
25
+        $json = json_decode($request->getContent(), true);
26
+        $device = $this->manager->getRepository(People::class)->findOneBy(['device' => $request->headers->get('device')]);
27
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
28
+        $configs = $this->configService->discoveryMainConfigs($people, $device);
29
+        return new JsonResponse($this->hydratorService->collectionData($configs, Config::class, 'config:read'));
30 30
     } catch (Exception $e) {
31
-      return new JsonResponse($this->hydratorService->error($e));
31
+        return new JsonResponse($this->hydratorService->error($e));
32
+    }
32 33
     }
33
-  }
34 34
 }
Please login to merge, or discard this patch.
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.