| 1 | <?php |
||
| 13 | class WidgetCache |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var Client |
||
| 17 | */ |
||
| 18 | private $redis; |
||
| 19 | |||
| 20 | public function __construct(Client $redis) |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param Widget $widget |
||
| 27 | * |
||
| 28 | * @return string |
||
| 29 | */ |
||
| 30 | public function fetch(Widget $widget) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param Widget $widget |
||
| 37 | * @param $content |
||
| 38 | */ |
||
| 39 | public function save(Widget $widget, $content) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param Widget $widget |
||
| 50 | * |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | protected function getHash(Widget $widget) |
||
| 71 | |||
| 72 | |||
| 73 | } |
||
| 74 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: