/** * @param bool $shouldCheckTokenOfUnsafeMethods * @return void */ public function run($shouldCheckTokenOfUnsafeMethods = true) { $tokenName = $this->getTokenName(); $token = Request::getCookieParam($tokenName); if ($shouldCheckTokenOfUnsafeMethods === false || $this->isSafeMethod(Request::getMethod())) { if ($token === null) { $this->initializeToken(); } } else { if ($token === null) { throw new ForbiddenException(); } else { $tmp = Request::getBodyParam($tokenName); if ($tmp === $token) { return; } if ($tmp !== null) { $this->initializeToken(); } throw new ForbiddenException(); } } }
/** * @param string $name * @param mixed $default * @return mixed */ public function getBodyParam($name, $default = null) { return Request::getBodyParam($name, $default); }