currentTime = $currentTime; $this->threshold = $threshold; $this->storage = $storage; } /** * Saves the version number to the storage to indicate the message as being dismissed. */ public function dismiss() { $this->storage->set( $this->currentTime ); } /** * Checks if the current time is lower than the stored time extended by the threshold. * * @return bool True when current time is lower than stored value + threshold. */ public function isDismissed() { return ( $this->currentTime <= ( $this->storage->get() + $this->threshold ) ); } }