3 namespace Drupal\Core\Access;
6 * Interface for access result value objects with stored reason for developers.
8 * For example, a developer can specify the reason for forbidden access:
10 * new AccessResultForbidden('You are not authorized to hack core');
13 * @see \Drupal\Core\Access\AccessResultInterface
15 interface AccessResultReasonInterface extends AccessResultInterface {
18 * Gets the reason for this access result.
21 * The reason of this access result or NULL if no reason is provided.
23 public function getReason();
26 * Sets the reason for this access result.
28 * @param $reason string|null
29 * The reason of this access result or NULL if no reason is provided.
31 * @return \Drupal\Core\Access\AccessResultInterface
32 * The access result instance.
34 public function setReason($reason);