| Server IP : 145.239.37.162 / Your IP : 216.73.217.81 Web Server : Apache System : Linux webm003.cluster130.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : verseaa ( 38250) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/verseaa/www1/wp-content/plugins/wordpress-seo/vendor/yoast/whip/src/ |
Upload File : |
<?php
/**
* WHIP libary file.
*
* @package Yoast\WHIP
*/
/**
* A class to dismiss messages.
*/
class Whip_MessageDismisser {
/**
* Storage object to manage the dismissal state.
*
* @var Whip_DismissStorage
*/
protected $storage;
/**
* The current time.
*
* @var string
*/
protected $currentTime;
/**
* The number of seconds the message will be dismissed.
*
* @var int
*/
protected $threshold;
/**
* Whip_MessageDismisser constructor.
*
* @param int $currentTime The current time.
* @param int $threshold The number of seconds the message will be dismissed.
* @param Whip_DismissStorage $storage Storage object to manage the dismissal state.
*/
public function __construct( $currentTime, $threshold, Whip_DismissStorage $storage ) {
$this->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 ) );
}
}