for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/*
* This file is part of Flight Routing.
*
* PHP version 7.1 and above required
* @author Divine Niiquaye Ibok <[email protected]>
* @copyright 2019 Biurad Group (https://biurad.com/)
* @license https://opensource.org/licenses/BSD-3-Clause License
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flight\Routing\Exceptions;
use Flight\Routing\Interfaces\ExceptionInterface;
use RuntimeException;
/**
* HTTP 405 exception.
class MethodNotAllowedException extends RuntimeException implements ExceptionInterface
{
/** @var string[] */
private $methods;
* @param string[] $methods
* @param string $path
* @param string $method
public function __construct(array $methods, string $path, string $method)
$this->methods = $methods;
$message = 'Unfortunately current uri "%s" is not allowed on [%s] request methods, "%s" is invalid';
parent::__construct(\sprintf($message, $path, \implode(',', $methods), $method), 405);
}
* Gets allowed methods
* @return string[]
public function getAllowedMethods(): array
return $this->methods;