I've just come up with an idea to make humanTime
extendable.
- Create a class called
Utility
- Create a static function called
humanTime
in class, which is the original humanTime
- (For backward compatibility) Make the original
humanTime
a wrapper that calls the humanTime
in Utility
In this way if an extension wants to extend humanTime
, it can use extend
with Utility
to accomplish it.
Edit:
One thing to mention.
In this approach, to use the humanTime
, the caller should only keep the reference to Utility
class, not Utility.humanTime
. Otherwise, the extenders and overriders won't work.