ScopeEntity.php in Simple OAuth (OAuth2) & OpenID Connect 8.3
File
src/Entities/ScopeEntity.php
View source
<?php
namespace Drupal\simple_oauth\Entities;
use Drupal\Core\Cache\RefinableCacheableDependencyTrait;
use Drupal\user\RoleInterface;
use League\OAuth2\Server\Entities\Traits\EntityTrait;
class ScopeEntity implements ScopeEntityNameInterface {
use EntityTrait, RefinableCacheableDependencyTrait;
protected $name;
public function __construct(RoleInterface $role) {
$this->role = $role;
$this
->setIdentifier($role
->id());
$this->name = $role
->label();
$this
->addCacheableDependency($role);
}
public function jsonSerialize() {
return $this
->getIdentifier();
}
public function getName() {
return $this->name;
}
public function getDescription() {
return NULL;
}
}