Conditions | 5 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
53 | protected function getHash(Widget $widget) |
||
54 | { |
||
55 | $hash = null; |
||
56 | if ($widget->getMode() == Widget::MODE_BUSINESS_ENTITY |
||
57 | && ($entity = $widget->getEntity()) |
||
58 | && method_exists($widget->getEntity(), 'getUpdatedAt')) { |
||
59 | $hash = sprintf('%s-%s--%s-%s', |
||
60 | $widget->getId(), |
||
61 | $widget->getUpdatedAt()->getTimestamp(), |
||
62 | $entity->getId(), |
||
63 | $entity->getUpdatedAt()->getTimestamp() |
||
64 | ); |
||
65 | } elseif ($widget->getMode() == Widget::MODE_STATIC) { |
||
66 | $hash = sprintf('%s-%s', $widget->getId(), $widget->getUpdatedAt()->getTimestamp()); |
||
67 | } |
||
68 | |||
69 | return $hash; |
||
70 | } |
||
71 | |||
74 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: