Yoast\WP\SEO\Expiring_Store\Application
Expiring_Store::prefix_for_user
Prefixes a key for user scope.
Метод класса: Expiring_Store{}
Хуков нет.
Возвращает
Строку. The prefixed key.
Использование
// private - только в коде основоного (родительского) класса $result = $this->prefix_for_user( $key, $user_id ): string;
- $key(строка) (обязательный)
- The key.
- $user_id(int)
- The user ID. When 0, falls back to the current user.
Код Expiring_Store::prefix_for_user() Expiring Store::prefix for user Yoast 27.7
private function prefix_for_user( string $key, int $user_id = 0 ): string {
if ( $user_id <= 0 ) {
$user_id = \get_current_user_id();
}
if ( $user_id === 0 ) {
throw new No_Current_User_Exception( 'Cannot use user-scoped expiring store methods without a logged-in user.' );
}
return 'user_' . $user_id . ':' . $key;
}