Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Core / Access / AccessResultForbidden.php
1 <?php
2
3 namespace Drupal\Core\Access;
4
5 /**
6  * Value object indicating a forbidden access result, with cacheability metadata.
7  */
8 class AccessResultForbidden extends AccessResult implements AccessResultReasonInterface {
9
10   /**
11    * The reason why access is forbidden. For use in error messages.
12    *
13    * @var string|null
14    */
15   protected $reason;
16
17   /**
18    * Constructs a new AccessResultForbidden instance.
19    *
20    * @param null|string $reason
21    *   (optional) A message to provide details about this access result.
22    */
23   public function __construct($reason = NULL) {
24     $this->reason = $reason;
25   }
26
27
28   /**
29    * {@inheritdoc}
30    */
31   public function isForbidden() {
32     return TRUE;
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function getReason() {
39     return $this->reason;
40   }
41
42   /**
43    * {@inheritdoc}
44    */
45   public function setReason($reason) {
46     $this->reason = $reason;
47     return $this;
48   }
49
50 }