headless_cms-1.0.3/modules/headless_cms_preview/src/Session/AccountProxyWrapper.php
modules/headless_cms_preview/src/Session/AccountProxyWrapper.php
<?php
declare(strict_types=1);
namespace Drupal\headless_cms_preview\Session;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\AccountProxyInterface;
/**
* A simple wrapper to wrap an account in a AccountProxyWrapper.
*/
class AccountProxyWrapper implements AccountProxyInterface {
public function __construct(
protected AccountInterface $account,
) {}
/**
* {@inheritdoc}
*/
public function setAccount(AccountInterface $account) {
$this->account = $account;
}
/**
* {@inheritdoc}
*/
public function getAccount() {
return $this->account;
}
/**
* {@inheritdoc}
*/
public function setInitialAccountId($account_id) {}
/**
* {@inheritdoc}
*/
public function id() {
return $this->account->id();
}
/**
* {@inheritdoc}
*/
public function getRoles($exclude_locked_roles = FALSE) {
return $this->account->getRoles($exclude_locked_roles);
}
/**
* {@inheritdoc}
*/
public function hasPermission($permission) {
return $this->account->hasPermission($permission);
}
/**
* {@inheritdoc}
*/
public function isAuthenticated() {
return $this->account->isAuthenticated();
}
/**
* {@inheritdoc}
*/
public function isAnonymous() {
return $this->account->isAnonymous();
}
/**
* {@inheritdoc}
*/
public function getPreferredLangcode($fallback_to_default = TRUE) {
return $this->account->getPreferredLangcode($fallback_to_default);
}
/**
* {@inheritdoc}
*/
public function getPreferredAdminLangcode($fallback_to_default = TRUE) {
return $this->account->getPreferredAdminLangcode($fallback_to_default);
}
/**
* {@inheritdoc}
*/
public function getAccountName() {
return $this->account->getAccountName();
}
/**
* {@inheritdoc}
*/
public function getDisplayName() {
return $this->account->getDisplayName();
}
/**
* {@inheritdoc}
*/
public function getEmail() {
return $this->account->getEmail();
}
/**
* {@inheritdoc}
*/
public function getTimeZone() {
return $this->account->getTimeZone();
}
/**
* {@inheritdoc}
*/
public function getLastAccessedTime() {
return $this->account->getLastAccessedTime();
}
}
