1 | <?php |
||
20 | abstract class LastRefreshAbstract |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * @var CurrentUserInterface |
||
25 | */ |
||
26 | protected $_CurrentUser; |
||
27 | |||
28 | /** |
||
29 | * @var \DateTimeInterface timestamp |
||
30 | */ |
||
31 | protected $_timestamp = null; |
||
32 | |||
33 | /** |
||
34 | * @var mixed storage object depending on implementation |
||
35 | */ |
||
36 | protected $_storage; |
||
37 | |||
38 | /** |
||
39 | * Constructor |
||
40 | * |
||
41 | * @param CurrentUserInterface $CurrentUser current-user |
||
42 | * @param mixed $storage storage a storage handler |
||
43 | */ |
||
44 | public function __construct(CurrentUserInterface $CurrentUser, $storage = null) |
||
49 | |||
50 | /** |
||
51 | * Checks if last refresh newer than $timestamp. |
||
52 | * |
||
53 | * Performance sensitive: every posting on /entries/index may be |
||
54 | * tested if new for user. |
||
55 | * |
||
56 | * @param string|\DateTimeInterface $timestamp int unix-timestamp or date as string |
||
57 | * @return mixed bool or null if not determinable |
||
58 | */ |
||
59 | public function isNewerThan($timestamp) |
||
69 | |||
70 | /** |
||
71 | * returns last refresh timestamp |
||
72 | * |
||
73 | * @return mixed int if unix timestamp or bool false if uninitialized |
||
74 | */ |
||
75 | abstract protected function _get(); |
||
76 | |||
77 | /** |
||
78 | * Mark last refresh as "now" |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | public function set(): void |
||
91 | |||
92 | /** |
||
93 | * Set timestamp implementation |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | abstract protected function _set(); |
||
98 | } |
||
99 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: