@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | public function discoveryDevice(&$entity) |
38 | 38 | { |
39 | - if ($entity instanceof Device || $entity instanceof DeviceConfig) |
|
40 | - return; |
|
39 | + if ($entity instanceof Device || $entity instanceof DeviceConfig) { |
|
40 | + return; |
|
41 | + } |
|
41 | 42 | |
42 | 43 | $deviceId = $this->request->headers->get('DEVICE') ?: $this->getUserIp(); |
43 | 44 | if (method_exists($entity, 'setDevice')) { |
@@ -48,14 +49,16 @@ discard block |
||
48 | 49 | |
49 | 50 | public function discoveryUser(&$entity) |
50 | 51 | { |
51 | - if (method_exists($entity, 'setUser')) |
|
52 | - $entity->setUser($this->security->getToken()->getUser()); |
|
52 | + if (method_exists($entity, 'setUser')) { |
|
53 | + $entity->setUser($this->security->getToken()->getUser()); |
|
54 | + } |
|
53 | 55 | } |
54 | 56 | |
55 | 57 | public function persist(&$entity) |
56 | 58 | { |
57 | - if (self::$persisted == true) |
|
58 | - return; |
|
59 | + if (self::$persisted == true) { |
|
60 | + return; |
|
61 | + } |
|
59 | 62 | self::$persisted = true; |
60 | 63 | |
61 | 64 | //$this->manager->persist($entity); |
@@ -73,15 +76,17 @@ discard block |
||
73 | 76 | } else { |
74 | 77 | $json = json_decode($this->request->getContent(), true); |
75 | 78 | $extra_data = isset($json['extra-data']) ? $json['extra-data'] : null; |
76 | - if (!$extra_data) |
|
77 | - return; |
|
79 | + if (!$extra_data) { |
|
80 | + return; |
|
81 | + } |
|
78 | 82 | $entity_id = $extra_data['entity_id']; |
79 | 83 | $entity_name = $extra_data['entity_name']; |
80 | 84 | } |
81 | 85 | |
82 | 86 | |
83 | - if (!$entity_id || !$entity_name) |
|
84 | - return; |
|
87 | + if (!$entity_id || !$entity_name) { |
|
88 | + return; |
|
89 | + } |
|
85 | 90 | |
86 | 91 | foreach ($extra_data['data'] as $key => $data) { |
87 | 92 | $extra_fields = $this->manager->getRepository(ExtraFields::class)->find($key); |
@@ -92,8 +97,9 @@ discard block |
||
92 | 97 | 'extra_fields' => $extra_fields |
93 | 98 | ]); |
94 | 99 | |
95 | - if (!$extraData) |
|
96 | - $extraData = new ExtraData(); |
|
100 | + if (!$extraData) { |
|
101 | + $extraData = new ExtraData(); |
|
102 | + } |
|
97 | 103 | |
98 | 104 | $extraData->setExtraFields($extra_fields); |
99 | 105 | $extraData->setEntityName($entity_name); |