You are here

AccessResultNeutral.php in Drupal 8

Same filename and directory in other branches
  1. 9 core/lib/Drupal/Core/Access/AccessResultNeutral.php

Namespace

Drupal\Core\Access

File

core/lib/Drupal/Core/Access/AccessResultNeutral.php
View source
<?php

namespace Drupal\Core\Access;


/**
 * Value object indicating a neutral access result, with cacheability metadata.
 */
class AccessResultNeutral extends AccessResult implements AccessResultReasonInterface {

  /**
   * The reason why access is neutral. For use in messages.
   *
   * @var string|null
   */
  protected $reason;

  /**
   * Constructs a new AccessResultNeutral instance.
   *
   * @param null|string $reason
   *   (optional) A message to provide details about this access result
   */
  public function __construct($reason = NULL) {
    $this->reason = $reason;
  }

  /**
   * {@inheritdoc}
   */
  public function isNeutral() {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function getReason() {
    return $this->reason;
  }

  /**
   * {@inheritdoc}
   */
  public function setReason($reason) {
    $this->reason = $reason;
    return $this;
  }

}

Classes

Namesort descending Description
AccessResultNeutral Value object indicating a neutral access result, with cacheability metadata.