original_string: public function isRoleScopePresentOnce(ExecutionContextInterface $context) 
      {
          $roleScopesId = array_map(function(RoleScope $roleScope) {
                      return $roleScope->getId();
                  }, 
                  $this->getRoleScopes()->toArray());
          $countedIds = array_count_values($roleScopesId);
          
          foreach ($countedIds as $id => $nb) {
              if ($nb > 1) {
                  $context->buildViolation("A permission is already present "
                          . "for the same role and scope")
                          ->addViolation();
              }
          }
      }
code: public function isRoleScopePresentOnce(ExecutionContextInterface $context) 
      {
          $roleScopesId = array_map(function(RoleScope $roleScope) {
                      return $roleScope->getId();
                  }, 
                  $this->getRoleScopes()->toArray());
          $countedIds = array_count_values($roleScopesId);
          
          foreach ($countedIds as $id => $nb) {
              if ($nb > 1) {
                  $context->buildViolation("A permission is already present "
                          . "for the same role and scope")
                          ->addViolation();
              }
          }
      }
code_tokens: public function isRoleScopePresentOnce ( ExecutionContextInterface $ context ) { $ roleScopesId = array_map ( function ( RoleScope $ roleScope ) { return $ roleScope -> getId ( ) ; } , $ this -> getRoleScopes ( ) -> toArray ( ) ) ; $ countedIds = array_count_values ( $ roleScopesId ) ; foreach ( $ countedIds as $ id => $ nb ) { if ( $ nb > 1 ) { $ context -> buildViolation ( "A permission is already present " . "for the same role and scope" ) -> addViolation ( ) ; } } }
docstring: Test that a role scope is associated only once with the permission group
  
  @param ExecutionContextInterface $context
docstring_tokens: Test that a role scope is associated only once with the permission group