Identity/RoleSecurityIdentity.php
public static function fromToken(TokenInterface $token)
    {
        $user = $token->getUser();

        if ($user instanceof RoleableInterface) {
            $sids = [];
            $roles = $user->getRoles();

            foreach ($roles as $role) {
                $sids[] = self::fromAccount($role);
            }

            return $sids;
        }

        throw new InvalidArgumentException('The user class must implement "Fxp\Component\Security\Model\Traits\RoleableInterface"');
    }
public static function fromToken(TokenInterface $token)
    {
        $user = $token->getUser();

        if ($user instanceof RoleableInterface) {
            $sids = [];
            $roles = $user->getRoles();

            foreach ($roles as $role) {
                $sids[] = self::fromAccount($role);
            }

            return $sids;
        }

        throw new InvalidArgumentException('The user class must implement "Fxp\Component\Security\Model\Traits\RoleableInterface"');
    }
public static function fromToken ( TokenInterface $ token ) { $ user = $ token -> getUser ( ) ; if ( $ user instanceof RoleableInterface ) { $ sids = [ ] ; $ roles = $ user -> getRoles ( ) ; foreach ( $ roles as $ role ) { $ sids [ ] = self :: fromAccount ( $ role ) ; } return $ sids ; } throw new InvalidArgumentException ( 'The user class must implement "Fxp\Component\Security\Model\Traits\RoleableInterface"' ) ; }
Creates a role security identity from a TokenInterface.

@param TokenInterface $token The token

@throws InvalidArgumentException When the user class not implements "Fxp\Component\Security\Model\Traits\RoleableInterface"

@return self[]
Creates a role security identity from a TokenInterface .