| Conditions | 6 |
| Paths | 7 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function generateKey($meta) |
||
| 31 | { |
||
| 32 | if (is_object($meta) && $meta instanceof Meta) { |
||
| 33 | $value = $meta->getValues(); |
||
| 34 | $keyElements = []; |
||
| 35 | |||
| 36 | if ($value instanceof TimestampableInterface) { |
||
| 37 | $date = null !== $value->getUpdatedAt() ? $value->getUpdatedAt() : $value->getCreatedAt(); |
||
| 38 | $keyElements[] = $date->getTimestamp(); |
||
| 39 | } |
||
| 40 | |||
| 41 | if ($value instanceof PersistableInterface) { |
||
| 42 | $keyElements[] = $value->getId(); |
||
| 43 | } |
||
| 44 | |||
| 45 | return sha1(implode('', $keyElements)); |
||
| 46 | } |
||
| 47 | |||
| 48 | return sha1(serialize($meta)); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |