original_string: public function get_course_ids($categories) {
          $courseids = array();
          foreach ($categories as $key=>$cat) {
              $courseids[$key] = $cat->course;
              if (!empty($cat->children)) {
                  $courseids = array_merge($courseids, $this->get_course_ids($cat->children));
              }
          }
          return $courseids;
      }
code: public function get_course_ids($categories) {
          $courseids = array();
          foreach ($categories as $key=>$cat) {
              $courseids[$key] = $cat->course;
              if (!empty($cat->children)) {
                  $courseids = array_merge($courseids, $this->get_course_ids($cat->children));
              }
          }
          return $courseids;
      }
code_tokens: public function get_course_ids ( $ categories ) { $ courseids = array ( ) ; foreach ( $ categories as $ key => $ cat ) { $ courseids [ $ key ] = $ cat -> course ; if ( ! empty ( $ cat -> children ) ) { $ courseids = array_merge ( $ courseids , $ this -> get_course_ids ( $ cat -> children ) ) ; } } return $ courseids ; }
docstring: gets all the courseids for the given categories
  
  @param array categories contains category objects in  a tree representation
  @return array courseids flat array in form categoryid=>courseid
docstring_tokens: gets all the courseids for the given categories