original_string: public function getReachableCenters(User $user, Role $role, Scope $scope = null)
      {
          $centers = array();
          
          foreach ($user->getGroupCenters() as $groupCenter){
              $permissionGroup = $groupCenter->getPermissionsGroup();
              //iterate on roleScopes
              foreach($permissionGroup->getRoleScopes() as $roleScope) {
                  //check that the role is in the reachable roles
                  if ($this->isRoleReached($role, 
                        new Role($roleScope->getRole()))) {
                      if ($scope === null) {
                          $centers[] = $groupCenter->getCenter();
                          break 1;
                      } else {
                          if ($scope->getId() == $roleScope->getScope()->getId()){
                              $centers[] = $groupCenter->getCenter();
                              break 1;
                          }      
                      }
                  }
              }
              
          }
          
          return $centers;
      }
code: public function getReachableCenters(User $user, Role $role, Scope $scope = null)
      {
          $centers = array();
          
          foreach ($user->getGroupCenters() as $groupCenter){
              $permissionGroup = $groupCenter->getPermissionsGroup();
              //iterate on roleScopes
              foreach($permissionGroup->getRoleScopes() as $roleScope) {
                  //check that the role is in the reachable roles
                  if ($this->isRoleReached($role, 
                        new Role($roleScope->getRole()))) {
                      if ($scope === null) {
                          $centers[] = $groupCenter->getCenter();
                          break 1;
                      } else {
                          if ($scope->getId() == $roleScope->getScope()->getId()){
                              $centers[] = $groupCenter->getCenter();
                              break 1;
                          }      
                      }
                  }
              }
              
          }
          
          return $centers;
      }
code_tokens: public function getReachableCenters ( User $ user , Role $ role , Scope $ scope = null ) { $ centers = array ( ) ; foreach ( $ user -> getGroupCenters ( ) as $ groupCenter ) { $ permissionGroup = $ groupCenter -> getPermissionsGroup ( ) ; //iterate on roleScopes foreach ( $ permissionGroup -> getRoleScopes ( ) as $ roleScope ) { //check that the role is in the reachable roles if ( $ this -> isRoleReached ( $ role , new Role ( $ roleScope -> getRole ( ) ) ) ) { if ( $ scope === null ) { $ centers [ ] = $ groupCenter -> getCenter ( ) ; break 1 ; } else { if ( $ scope -> getId ( ) == $ roleScope -> getScope ( ) -> getId ( ) ) { $ centers [ ] = $ groupCenter -> getCenter ( ) ; break 1 ; } } } } } return $ centers ; }
docstring: Get reachable Centers for the given user, role,
  and optionnaly Scope
  
  @param User $user
  @param Role $role
  @param null|Scope $scope
  @return Center[]
docstring_tokens: Get reachable Centers for the given user role and optionnaly Scope