src/Security/Authorization.php
public function guard($loginRoute = null)
    {
        $base = Base::instance();
        $currentPath = $base['PATH'];

        $this->parseFirewalls();

        if (
            $this->firewalls['pattern']
            && preg_match($this->firewalls['pattern'], $currentPath, $matches)
        ) {
            $key = static::pathName($matches['path']);
            $config = $this->firewalls['paths'][$key];

            if (!$this->isGranted($config['roles'])) {
                $base->reroute($loginRoute ?: $config['login_route']);
            }
        }

        return $this;
    }
public function guard($loginRoute = null)
    {
        $base = Base::instance();
        $currentPath = $base['PATH'];

        $this->parseFirewalls();

        if (
            $this->firewalls['pattern']
            && preg_match($this->firewalls['pattern'], $currentPath, $matches)
        ) {
            $key = static::pathName($matches['path']);
            $config = $this->firewalls['paths'][$key];

            if (!$this->isGranted($config['roles'])) {
                $base->reroute($loginRoute ?: $config['login_route']);
            }
        }

        return $this;
    }
public function guard ( $ loginRoute = null ) { $ base = Base :: instance ( ) ; $ currentPath = $ base [ 'PATH' ] ; $ this -> parseFirewalls ( ) ; if ( $ this -> firewalls [ 'pattern' ] && preg_match ( $ this -> firewalls [ 'pattern' ] , $ currentPath , $ matches ) ) { $ key = static :: pathName ( $ matches [ 'path' ] ) ; $ config = $ this -> firewalls [ 'paths' ] [ $ key ] ; if ( ! $ this -> isGranted ( $ config [ 'roles' ] ) ) { $ base -> reroute ( $ loginRoute ? : $ config [ 'login_route' ] ) ; } } return $ this ; }
Do guarding controller
@param  string|null $loginRoute
@return $this
Do guarding controller