Example #1
0
 /**
  * Check if this feature is active for the given userId
  * @param RolloutAbstract $rollout
  * @param DeterminableUserInterface|null $user
  * @internal param int $userId
  * @return bool
  */
 public function isActive(RolloutAbstract $rollout, DeterminableUserInterface $user = null)
 {
     if (100 === $this->getPercentage()) {
         return true;
     }
     if (!$user instanceof DeterminableUserInterface) {
         return false;
     }
     $userId = $user->getId();
     if (true === $this->isUserInPercentage($userId) || true === $this->isUserInActiveUsers($userId) || true === $this->isUserInActiveRole($user, $rollout) || true === $this->isUserInActiveGroup($user, $rollout)) {
         return true;
     }
     return false;
 }