src/ViKon/Auth/RouterAuth.php
public function getRoles($name)
    {
        $route = $this->router->getRoutes()->getByName($name);

        // If route not exists, return NULL
        if ($route === null) {
            return null;
        }

        $roles = [];

        // Get permissions from array syntax
        $action = $route->getAction();

        if (array_key_exists('role', $action)) {
            $roles[] = $action['role'];
        }

        if (array_key_exists('roles', $action)) {
            $roles = array_merge($roles, $action['roles']);
        }

        return array_unique($roles);
    }
public function getRoles($name)
    {
        $route = $this->router->getRoutes()->getByName($name);

        // If route not exists, return NULL
        if ($route === null) {
            return null;
        }

        $roles = [];

        // Get permissions from array syntax
        $action = $route->getAction();

        if (array_key_exists('role', $action)) {
            $roles[] = $action['role'];
        }

        if (array_key_exists('roles', $action)) {
            $roles = array_merge($roles, $action['roles']);
        }

        return array_unique($roles);
    }
public function getRoles ( $ name ) { $ route = $ this -> router -> getRoutes ( ) -> getByName ( $ name ) ; // If route not exists, return NULL if ( $ route === null ) { return null ; } $ roles = [ ] ; // Get permissions from array syntax $ action = $ route -> getAction ( ) ; if ( array_key_exists ( 'role' , $ action ) ) { $ roles [ ] = $ action [ 'role' ] ; } if ( array_key_exists ( 'roles' , $ action ) ) { $ roles = array_merge ( $ roles , $ action [ 'roles' ] ) ; } return array_unique ( $ roles ) ; }
Get roles for named route

@param string $name named route named

@return string[]|null NULL if route not found, otherwise array of roles
Get roles for named route