| Conditions | 5 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function generateHashes(Device $device): Device |
||
| 22 | { |
||
| 23 | $data = \json_decode($device->getFingerprint(), true); |
||
| 24 | |||
| 25 | if (\is_array($data) && \JSON_ERROR_NONE === \json_last_error()) { |
||
| 26 | foreach (self::HASHES as $field) { |
||
| 27 | $method = 'set'.\ucfirst($field); |
||
| 28 | $value = \array_key_exists($field, $data) ? \md5(\serialize($data[$field])) : null; |
||
| 29 | $device->$method($value); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | return $device; |
||
| 34 | } |
||
| 36 |