Conditions | 6 |
Paths | 14 |
Total Lines | 24 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php namespace Anomaly\Streams\Platform\View\Cache; |
||
26 | public function generateKey($value) |
||
27 | { |
||
28 | if ($value instanceof Presenter) { |
||
29 | $value = $value->getObject(); |
||
30 | } |
||
31 | |||
32 | if ($value instanceof EntryInterface) { |
||
33 | return get_class($value) . $value->getId() . $value->lastModified(); |
||
34 | } |
||
35 | |||
36 | if ($value instanceof Arrayable) { |
||
37 | $value = $value->toArray(); |
||
38 | } |
||
39 | |||
40 | if (is_array($value)) { |
||
41 | return 'array_' . md5(json_encode($value)); |
||
42 | } |
||
43 | |||
44 | if (is_string($value)) { |
||
45 | return 'string_' . md5($value); |
||
46 | } |
||
47 | |||
48 | return ''; |
||
49 | } |
||
50 | } |
||
51 |