More PHPCS fixes.

This commit is contained in:
Peter Fabian 2019-12-05 15:46:13 +01:00
parent 2e81f21e29
commit 4dfa68b62d
2 changed files with 6 additions and 6 deletions

View File

@ -34,7 +34,7 @@ class WC_Rate_Limiter {
/**
* Constructs Option name from action identifier.
*
* @param string $action_id
* @param string $action_id Identifier of the action.
* @return string
*/
public static function storage_id( $action_id ) {
@ -44,7 +44,7 @@ class WC_Rate_Limiter {
/**
* Returns true if the action is not allowed to be run by the rate limiter yet, false otherwise.
*
* @param string $action_id Identifier for the action
* @param string $action_id Identifier of the action.
* @return bool
*/
public static function retried_too_soon( $action_id ) {
@ -67,8 +67,8 @@ class WC_Rate_Limiter {
/**
* Sets the rate limit delay in seconds for action with identifier $id.
*
* @param string $action_id Identifier for the action.
* @param int $delay Delay in seconds.
* @param string $action_id Identifier of the action.
* @param int $delay Delay in seconds.
* @return bool True if the option setting was successful, false otherwise.
*/
public static function set_rate_limit( $action_id, $delay ) {

View File

@ -42,8 +42,8 @@ class WC_Tests_Rate_Limiter extends WC_Unit_Test_Case {
$this->assertEquals( true, WC_Rate_Limiter::retried_too_soon( $rate_limit_id_1 ), 'retried_too_soon allowed action to run too soon before the delay.' );
$this->assertEquals( false, WC_Rate_Limiter::retried_too_soon( $rate_limit_id_2 ), 'retried_too_soon did not allow action to run for another user before the delay.' );
// As retired_too_soon bails if current time <= limit, the actual time needs to be at least 1 second after the limit.
sleep(2);
// As retired_too_soon bails if current time <= limit, the actual time needs to be at least 1 second after the limit.
sleep( 2 );
$this->assertEquals( false, WC_Rate_Limiter::retried_too_soon( $rate_limit_id_1 ), 'retried_too_soon did not allow action to run after the designated delay.' );
$this->assertEquals( false, WC_Rate_Limiter::retried_too_soon( $rate_limit_id_2 ), 'retried_too_soon did not allow action to run for another user after the designated delay.' );