You are here

class ScopeEntity in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 src/Entities/ScopeEntity.php \Drupal\simple_oauth\Entities\ScopeEntity
  2. 8.2 src/Entities/ScopeEntity.php \Drupal\simple_oauth\Entities\ScopeEntity
  3. 8.3 src/Entities/ScopeEntity.php \Drupal\simple_oauth\Entities\ScopeEntity

Hierarchy

Expanded class hierarchy of ScopeEntity

2 files declare their use of ScopeEntity
OpenIdConnectScopeEntity.php in src/Entities/OpenIdConnectScopeEntity.php
ScopeRepository.php in src/Repositories/ScopeRepository.php

File

src/Entities/ScopeEntity.php, line 9

Namespace

Drupal\simple_oauth\Entities
View source
class ScopeEntity implements ScopeEntityNameInterface {
  use EntityTrait, RefinableCacheableDependencyTrait;

  /**
   * The name of this scope.
   *
   * @var string
   */
  protected $name;

  /**
   * Construct a ScopeEntity instance.
   *
   * @param \Drupal\User\RoleInterface $role
   *   The role associated to the scope.
   */
  public function __construct(RoleInterface $role) {
    $this->role = $role;
    $this
      ->setIdentifier($role
      ->id());
    $this->name = $role
      ->label();
    $this
      ->addCacheableDependency($role);
  }

  /**
   * {@inheritdoc}
   */
  public function jsonSerialize() {
    return $this
      ->getIdentifier();
  }

  /**
   * {@inheritdoc}
   */
  public function getName() {
    return $this->name;
  }

  /**
   * {@inheritdoc}
   */
  public function getDescription() {

    // Roles have no description.
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ScopeEntity::$name protected property The name of this scope.
ScopeEntity::getDescription public function Returns a description for the scope. Overrides ScopeEntityNameInterface::getDescription
ScopeEntity::getName public function Returns a name for the scope. Overrides ScopeEntityNameInterface::getName
ScopeEntity::jsonSerialize public function
ScopeEntity::__construct public function Construct a ScopeEntity instance. 1