You are here

class RedirectLoopException in Redirect 8

Exception for when a redirect loop is detected.

Hierarchy

  • class \Drupal\redirect\Exception\RedirectLoopException extends \Drupal\redirect\Exception\RuntimeException

Expanded class hierarchy of RedirectLoopException

3 files declare their use of RedirectLoopException
RedirectAPITest.php in tests/src/Kernel/RedirectAPITest.php
RedirectRepository.php in src/RedirectRepository.php
RedirectRequestSubscriber.php in src/EventSubscriber/RedirectRequestSubscriber.php

File

src/Exception/RedirectLoopException.php, line 10

Namespace

Drupal\redirect\Exception
View source
class RedirectLoopException extends \RuntimeException {

  /**
   * The looping path.
   *
   * @var string
   */
  protected $path;

  /**
   * The redirect ID.
   *
   * @var int
   */
  protected $rid;

  /**
   * Formats a redirect loop exception message.
   *
   * @param string $path
   *   The path that results in a redirect loop.
   * @param int $rid
   *   The redirect ID that is involved in a loop.
   */
  public function __construct($path, $rid) {
    $message = new FormattableMarkup('Redirect loop identified at %path for redirect %rid', [
      '%path' => $path,
      '%rid' => $rid,
    ]);
    $this->path = $path;
    $this->rid = $rid;
    parent::__construct($message);
  }

  /**
   * Returns the looping path.
   *
   * @return string
   *   The path.
   */
  public function getPath() {
    return $this->path;
  }

  /**
   * Returns the redirect ID.
   *
   * @return int
   *   The redirect ID.
   *
   */
  public function getRedirectId() {
    return $this->rid;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RedirectLoopException::$path protected property The looping path.
RedirectLoopException::$rid protected property The redirect ID.
RedirectLoopException::getPath public function Returns the looping path.
RedirectLoopException::getRedirectId public function Returns the redirect ID.
RedirectLoopException::__construct public function Formats a redirect loop exception message.