[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/router/src/Exception/ -> MethodNotAllowedException.php (source)

   1  <?php
   2  /**
   3   * Part of the Joomla Framework Router Package
   4   *
   5   * @copyright  Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
   6   * @license    GNU General Public License version 2 or later; see LICENSE
   7   */
   8  
   9  namespace Joomla\Router\Exception;
  10  
  11  /**
  12   * Exception defining a method not allowed error.
  13   *
  14   * @since  2.0.0
  15   */
  16  class MethodNotAllowedException extends \RuntimeException
  17  {
  18      /**
  19       * Allowed methods for the given route
  20       *
  21       * @var    string[]
  22       * @since  2.0.0
  23       */
  24      protected $allowedMethods = [];
  25  
  26      /**
  27       * Constructor.
  28       *
  29       * @param   array       $allowedMethods  The allowed methods for the route.
  30       * @param   null        $message         The Exception message to throw.
  31       * @param   integer     $code            The Exception code.
  32       * @param   \Exception  $previous        The previous throwable used for the exception chaining.
  33       */
  34  	public function __construct(array $allowedMethods, $message = null, $code = 405, \Exception $previous = null)
  35      {
  36          $this->allowedMethods = array_map('strtoupper', $allowedMethods);
  37  
  38          parent::__construct($message, $code, $previous);
  39      }
  40  
  41      /**
  42       * Gets the allowed HTTP methods.
  43       *
  44       * @return  array
  45       *
  46       * @since  2.0.0
  47       */
  48  	public function getAllowedMethods(): array
  49      {
  50          return $this->allowedMethods;
  51      }
  52  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer