protected function parseUri(Guard $guard) { foreach (explode('/', $this->uri) as $piece) { if (!empty($piece)) { $dir = $this->getDir() . '/' . ucfirst($piece); if (is_dir($dir)) { $this->controller = ""; $this->folders[] = ucfirst($piece); $protectionPath = implode('/', $this->folders); if ($guard->isGuarded($protectionPath)) { if ($guard->hasRedirect($protectionPath)) { $this->folders = explode('/', $guard->getDestination($protectionPath)); } else { $this->hasAccess = false; } } $this->definesController($this->getDir() . '/' . ucfirst($piece), $piece); } elseif ($this->definesController($dir, $piece)) { } else { $this->params[] = $piece; $this->controllerParams[] = $piece; } } } }
protected function isCsrfViolation(Guard $guard, $folder) { $csrfProtection = new CSRFProtector(); return $guard->hasCsrfProtection($folder) && !$csrfProtection->validCSRF(); }