"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.9/core/lib/Drupal/Core/Access/AccessResultForbidden.php" (18 Nov 2020, 911 Bytes) of package /linux/www/drupal-8.9.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "AccessResultForbidden.php" see the Fossies "Dox" file reference documentation.

    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    * {@inheritdoc}
   29    */
   30   public function isForbidden() {
   31     return TRUE;
   32   }
   33 
   34   /**
   35    * {@inheritdoc}
   36    */
   37   public function getReason() {
   38     return $this->reason;
   39   }
   40 
   41   /**
   42    * {@inheritdoc}
   43    */
   44   public function setReason($reason) {
   45     $this->reason = $reason;
   46     return $this;
   47   }
   48 
   49 }