first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace WPML\LIB\WP;
use WPML\Collect\Support\Traits\Macroable;
use function WPML\FP\curryN;
/**
* @method static callable|mixed get( ...$name ) - Curried :: string → mixed
* @method static callable|mixed getOr( ...$name, ...$default ) - Curried :: string → mixed → mixed
* @method static callable|mixed set( ...$name, ...$value, ...$expiration ) - Curried :: string → mixed → int -> mixed
* @method static callable|mixed delete( ...$name ) - Curried :: string → mxied
*/
class Transient {
use Macroable;
public static function init() {
self::macro( 'get', curryN( 1, 'get_transient' ) );
self::macro( 'getOr', curryN( 2, function ( $key, $default ) {
return self::get( $key ) ?: $default;
} ) );
self::macro( 'set', curryN( 3, 'set_transient' ) );
self::macro( 'delete', curryN( 1, 'delete_transient' ) );
}
}
Transient::init();