Passed
Push — master ( 95d3e9...838c5a )
by Luiz Kim
03:24 queued 52s
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
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function persist(&$entity)
49 49
     {
50
-        if (self::$persisted == true)
51
-            return;
50
+        if (self::$persisted == true) {
51
+                    return;
52
+        }
52 53
         self::$persisted = true;
53 54
 
54 55
         //$this->manager->persist($entity);
@@ -67,15 +68,17 @@  discard block
 block discarded – undo
67 68
         } else {
68 69
             $json =       json_decode($this->request->getContent(), true);
69 70
             $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null;
70
-            if (!$extra_data)
71
-                return;
71
+            if (!$extra_data) {
72
+                            return;
73
+            }
72 74
             $entity_id = $extra_data['entity_id'];
73 75
             $entity_name = $extra_data['entity_name'];
74 76
         }
75 77
 
76 78
 
77
-        if (!$entity_id || !$entity_name)
78
-            return;
79
+        if (!$entity_id || !$entity_name) {
80
+                    return;
81
+        }
79 82
 
80 83
         foreach ($extra_data['data'] as $key => $data) {
81 84
             $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key);
@@ -86,8 +89,9 @@  discard block
 block discarded – undo
86 89
                 'extra_fields' => $extra_fields
87 90
             ]);
88 91
 
89
-            if (!$extraData)
90
-                $extraData = new ExtraData();
92
+            if (!$extraData) {
93
+                            $extraData = new ExtraData();
94
+            }
91 95
 
92 96
             $extraData->setExtraFields($extra_fields);
93 97
             $extraData->setEntityName($entity_name);
Please login to merge, or discard this patch.
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.
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/Service/ConfigService.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
     public function getConfig(People $people, $key, $json = false)
27 27
     {
28 28
         $config = $this->discoveryConfig($people, $key, false);
29
-        $value =  $config ? $config->getConfigValue() : null;
29
+        $value = $config ? $config->getConfigValue() : null;
30 30
         return $json ? json_decode($value, true) : $value;
31 31
     }
32 32
 
33 33
     private function discoveryConfig(People $people, $key, $create = true): ?Config
34 34
     {
35
-        $config =   $this->manager->getRepository(Config::class)->findOneBy([
35
+        $config = $this->manager->getRepository(Config::class)->findOneBy([
36 36
             'people' => $people,
37 37
             'configKey' => $key
38 38
         ]);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@
 block discarded – undo
36 36
             'people' => $people,
37 37
             'configKey' => $key
38 38
         ]);
39
-        if ($config)
40
-            return $config;
39
+        if ($config) {
40
+                    return $config;
41
+        }
41 42
         if ($create) {
42 43
             $config = new Config();
43 44
             $config->setConfigKey($key);
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/Controller/AddDeviceConfigAction.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@
 block discarded – undo
37 37
         'device' => $json['device']
38 38
       ]);
39 39
       if (!$device)
40
-        $device  = new Device();
40
+        $device = new Device();
41 41
 
42 42
       foreach ($configs as $key => $config)
43
-        $device->addConfigs($key,  $config);
43
+        $device->addConfigs($key, $config);
44 44
       $device->setPeople($people);
45 45
       $device->setDevice($json['device']);
46 46
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,13 @@
 block discarded – undo
36 36
         'people' =>  $people,
37 37
         'device' => $json['device']
38 38
       ]);
39
-      if (!$device)
40
-        $device  = new Device();
39
+      if (!$device) {
40
+              $device  = new Device();
41
+      }
41 42
 
42
-      foreach ($configs as $key => $config)
43
-        $device->addConfigs($key,  $config);
43
+      foreach ($configs as $key => $config) {
44
+              $device->addConfigs($key,  $config);
45
+      }
44 46
       $device->setPeople($people);
45 47
       $device->setDevice($json['device']);
46 48
 
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -17,38 +17,38 @@
 block discarded – undo
17 17
 
18 18
 class AddDeviceConfigAction
19 19
 {
20
-  public function __construct(
20
+    public function __construct(
21 21
     private Security $security,
22 22
     private EntityManagerInterface $manager,
23 23
     private ConfigService $configService,
24 24
     private HydratorService $hydratorService
25
-  ) {}
25
+    ) {}
26 26
 
27
-  public function __invoke(Request $request): JsonResponse
28
-  {
27
+    public function __invoke(Request $request): JsonResponse
28
+    {
29 29
     try {
30
-      $json = json_decode($request->getContent(), true);
31
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
32
-      $configs = json_decode($json['configs'], true);
33
-      $device = $this->manager->getRepository(Device::class)->findOneBy([
30
+        $json = json_decode($request->getContent(), true);
31
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
32
+        $configs = json_decode($json['configs'], true);
33
+        $device = $this->manager->getRepository(Device::class)->findOneBy([
34 34
         'people' =>  $people,
35 35
         'device' => $json['device']
36
-      ]);
37
-      if (!$device)
36
+        ]);
37
+        if (!$device)
38 38
         $device  = new Device();
39 39
 
40
-      foreach ($configs as $key => $config)
40
+        foreach ($configs as $key => $config)
41 41
         $device->addConfigs($key,  $config);
42
-      $device->setPeople($people);
43
-      $device->setDevice($json['device']);
42
+        $device->setPeople($people);
43
+        $device->setDevice($json['device']);
44 44
 
45
-      $this->manager->persist($device);
46
-      $this->manager->flush();
45
+        $this->manager->persist($device);
46
+        $this->manager->flush();
47 47
 
48 48
 
49
-      return new JsonResponse($this->hydratorService->item(Device::class, $device->getId(), "device:read"), Response::HTTP_OK);
49
+        return new JsonResponse($this->hydratorService->item(Device::class, $device->getId(), "device:read"), Response::HTTP_OK);
50 50
     } catch (Exception $e) {
51
-      return new JsonResponse($this->hydratorService->error($e));
51
+        return new JsonResponse($this->hydratorService->error($e));
52
+    }
52 53
     }
53
-  }
54 54
 }
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.