Version 1
[yaffs-website] / web / core / lib / Drupal / Core / Access / AccessResultReasonInterface.php
1 <?php
2
3 namespace Drupal\Core\Access;
4
5 /**
6  * Interface for access result value objects with stored reason for developers.
7  *
8  * For example, a developer can specify the reason for forbidden access:
9  * @code
10  * new AccessResultForbidden('You are not authorized to hack core');
11  * @endcode
12  *
13  * @see \Drupal\Core\Access\AccessResultInterface
14  */
15 interface AccessResultReasonInterface extends AccessResultInterface {
16
17   /**
18    * Gets the reason for this access result.
19    *
20    * @return string|null
21    *   The reason of this access result or NULL if no reason is provided.
22    */
23   public function getReason();
24
25   /**
26    * Sets the reason for this access result.
27    *
28    * @param $reason string|null
29    *   The reason of this access result or NULL if no reason is provided.
30    *
31    * @return \Drupal\Core\Access\AccessResultInterface
32    *   The access result instance.
33    */
34   public function setReason($reason);
35
36 }