original_string: protected function build_limitcourseids(\stdClass $formdata) {
          $limitcourseids = false;
  
          if (!empty($formdata->mycoursesonly)) {
              $limitcourseids = array_keys($this->get_my_courses(false));
          }
  
          if (!empty($formdata->courseids)) {
              if (empty($limitcourseids)) {
                  $limitcourseids = $formdata->courseids;
              } else {
                  $limitcourseids = array_intersect($limitcourseids, $formdata->courseids);
              }
          }
  
          return $limitcourseids;
      }
code: protected function build_limitcourseids(\stdClass $formdata) {
          $limitcourseids = false;
  
          if (!empty($formdata->mycoursesonly)) {
              $limitcourseids = array_keys($this->get_my_courses(false));
          }
  
          if (!empty($formdata->courseids)) {
              if (empty($limitcourseids)) {
                  $limitcourseids = $formdata->courseids;
              } else {
                  $limitcourseids = array_intersect($limitcourseids, $formdata->courseids);
              }
          }
  
          return $limitcourseids;
      }
code_tokens: protected function build_limitcourseids ( \ stdClass $ formdata ) { $ limitcourseids = false ; if ( ! empty ( $ formdata -> mycoursesonly ) ) { $ limitcourseids = array_keys ( $ this -> get_my_courses ( false ) ) ; } if ( ! empty ( $ formdata -> courseids ) ) { if ( empty ( $ limitcourseids ) ) { $ limitcourseids = $ formdata -> courseids ; } else { $ limitcourseids = array_intersect ( $ limitcourseids , $ formdata -> courseids ) ; } } return $ limitcourseids ; }
docstring: Build a list of course ids to limit the search based on submitted form data.
  
  @param \stdClass $formdata Submitted search form data.
  
  @return array|bool
docstring_tokens: Build a list of course ids to limit the search based on submitted form data .