mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Fix lint
This commit is contained in:
parent
561d43baf6
commit
26a2b80b1b
6 changed files with 22 additions and 12 deletions
|
@ -848,7 +848,7 @@ return array(
|
|||
$purchase_unit_sanitizer = $container->get( 'api.helper.purchase-unit-sanitizer' );
|
||||
return new OrderTransient( $cache, $purchase_unit_sanitizer );
|
||||
},
|
||||
'api.helper.failure-registry' => static function( ContainerInterface $container ): FailureRegistry {
|
||||
'api.helper.failure-registry' => static function( ContainerInterface $container ): FailureRegistry {
|
||||
$cache = new Cache( 'ppcp-paypal-api-status-cache' );
|
||||
return new FailureRegistry( $cache );
|
||||
},
|
||||
|
|
|
@ -39,12 +39,14 @@ class FailureRegistry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* @param int $seconds
|
||||
* Returns if there was a failure within a given timeframe.
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @param int $seconds The timeframe in seconds.
|
||||
* @return bool
|
||||
*/
|
||||
public function has_failure_in_timeframe( string $key, int $seconds ): bool {
|
||||
$cache_key = $this->cache_key( $key );
|
||||
$cache_key = $this->cache_key( $key );
|
||||
$failure_time = $this->cache->get( $cache_key );
|
||||
|
||||
if ( ! $failure_time ) {
|
||||
|
@ -56,7 +58,9 @@ class FailureRegistry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* Registers a failure.
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @return void
|
||||
*/
|
||||
public function add_failure( string $key ) {
|
||||
|
@ -65,7 +69,9 @@ class FailureRegistry {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
* Clear a given failure.
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @return void
|
||||
*/
|
||||
public function clear_failures( string $key ) {
|
||||
|
@ -79,9 +85,9 @@ class FailureRegistry {
|
|||
* Build cache key.
|
||||
*
|
||||
* @param string $key The cache key.
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
private function cache_key( string $key ): ?string {
|
||||
private function cache_key( string $key ): string {
|
||||
return implode( '_', array( self::CACHE_KEY, $key ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue