original_string: public function check_access($id) {
          global $DB, $USER;
  
          $user = $DB->get_record('user', array('id' => $id));
          if (!$user || $user->deleted) {
              return \core_search\manager::ACCESS_DELETED;
          }
  
          if (user_can_view_profile($user)) {
              return \core_search\manager::ACCESS_GRANTED;
          }
  
          return \core_search\manager::ACCESS_DENIED;
      }
code: public function check_access($id) {
          global $DB, $USER;
  
          $user = $DB->get_record('user', array('id' => $id));
          if (!$user || $user->deleted) {
              return \core_search\manager::ACCESS_DELETED;
          }
  
          if (user_can_view_profile($user)) {
              return \core_search\manager::ACCESS_GRANTED;
          }
  
          return \core_search\manager::ACCESS_DENIED;
      }
code_tokens: public function check_access ( $ id ) { global $ DB , $ USER ; $ user = $ DB -> get_record ( 'user' , array ( 'id' => $ id ) ) ; if ( ! $ user || $ user -> deleted ) { return \ core_search \ manager :: ACCESS_DELETED ; } if ( user_can_view_profile ( $ user ) ) { return \ core_search \ manager :: ACCESS_GRANTED ; } return \ core_search \ manager :: ACCESS_DENIED ; }
docstring: Checking whether I can access a document
  
  @param int $id user id
  @return int
docstring_tokens: Checking whether I can access a document