Source of file CheckHttpMethod.php
Size: 0,694 Bytes - Last Modified: 2017-11-08T13:54:24+00:00
/home/travis/build/bluzphp/framework/src/Controller/Helper/CheckHttpMethod.php
123456789101112131415161718192021222324252627282930313233 | <?php /** * Bluz Framework Component * * @copyright Bluz PHP Team * @link https://github.com/bluzphp/framework */ declare(strict_types=1); namespace Bluz\Controller\Helper; use Bluz\Application\Exception\NotAllowedException; use Bluz\Controller\Controller; use Bluz\Proxy\Request; /** * Denied helper can be declared inside Bootstrap * * @return void * @throws NotAllowedException */ return function () { /** * @var Controller $this */ $methods = $this->getMeta()->getMethod(); if ($methods && !in_array(Request::getMethod(), $methods, true)) { throw new NotAllowedException(implode(',', $methods)); } }; |