class UncacheableTestAccessResult in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Access/AccessResultTest.php \Drupal\Tests\Core\Access\UncacheableTestAccessResult
Hierarchy
- class \Drupal\Tests\Core\Access\UncacheableTestAccessResult implements AccessResultInterface
Expanded class hierarchy of UncacheableTestAccessResult
File
- core/
tests/ Drupal/ Tests/ Core/ Access/ AccessResultTest.php, line 1005 - Contains \Drupal\Tests\Core\Access\AccessResultTest.
Namespace
Drupal\Tests\Core\AccessView source
class UncacheableTestAccessResult implements AccessResultInterface {
/**
* The access result value. 'ALLOWED', 'FORBIDDEN' or 'NEUTRAL'.
*
* @var string
*/
protected $value;
/**
* Constructs a new UncacheableTestAccessResult object.
*/
public function __construct($value) {
$this->value = $value;
}
/**
* {@inheritdoc}
*/
public function isAllowed() {
return $this->value === 'ALLOWED';
}
/**
* {@inheritdoc}
*/
public function isForbidden() {
return $this->value === 'FORBIDDEN';
}
/**
* {@inheritdoc}
*/
public function isNeutral() {
return $this->value === 'NEUTRAL';
}
/**
* {@inheritdoc}
*/
public function orIf(AccessResultInterface $other) {
if ($this
->isForbidden() || $other
->isForbidden()) {
return new static('FORBIDDEN');
}
elseif ($this
->isAllowed() || $other
->isAllowed()) {
return new static('ALLOWED');
}
else {
return new static('NEUTRAL');
}
}
/**
* {@inheritdoc}
*/
public function andIf(AccessResultInterface $other) {
if ($this
->isForbidden() || $other
->isForbidden()) {
return new static('FORBIDDEN');
}
elseif ($this
->isAllowed() && $other
->isAllowed()) {
return new static('ALLOWED');
}
else {
return new static('NEUTRAL');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UncacheableTestAccessResult:: |
protected | property | The access result value. 'ALLOWED', 'FORBIDDEN' or 'NEUTRAL'. | |
UncacheableTestAccessResult:: |
public | function |
Combine this access result with another using AND. Overrides AccessResultInterface:: |
|
UncacheableTestAccessResult:: |
public | function |
Checks whether this access result indicates access is explicitly allowed. Overrides AccessResultInterface:: |
|
UncacheableTestAccessResult:: |
public | function |
Checks whether this access result indicates access is explicitly forbidden. Overrides AccessResultInterface:: |
|
UncacheableTestAccessResult:: |
public | function |
Checks whether this access result indicates access is not yet determined. Overrides AccessResultInterface:: |
|
UncacheableTestAccessResult:: |
public | function |
Combine this access result with another using OR. Overrides AccessResultInterface:: |
|
UncacheableTestAccessResult:: |
public | function | Constructs a new UncacheableTestAccessResult object. |