/** * {@inheritDoc} */ public function collect(MvcEvent $mvcEvent) { if (!$this->identityProvider) { return; } $roles = $this->identityProvider->getIdentityRoles(); if (!is_array($roles) && !$roles instanceof \Traversable) { $roles = (array) $roles; } foreach ($roles as $role) { if ($role instanceof RoleInterface) { $role = $role->getRoleId(); } if ($role) { $this->collectedRoles[] = (string) $role; } } }