original_string: public static function get_course_image($course) {
          global $CFG;
          $courseinlist = new \core_course_list_element($course);
          foreach ($courseinlist->get_course_overviewfiles() as $file) {
              if ($file->is_valid_image()) {
                  $pathcomponents = [
                      '/pluginfile.php',
                      $file->get_contextid(),
                      $file->get_component(),
                      $file->get_filearea() . $file->get_filepath() . $file->get_filename()
                  ];
                  $path = implode('/', $pathcomponents);
                  return (new moodle_url($path))->out();
              }
          }
          return false;
      }
code: public static function get_course_image($course) {
          global $CFG;
          $courseinlist = new \core_course_list_element($course);
          foreach ($courseinlist->get_course_overviewfiles() as $file) {
              if ($file->is_valid_image()) {
                  $pathcomponents = [
                      '/pluginfile.php',
                      $file->get_contextid(),
                      $file->get_component(),
                      $file->get_filearea() . $file->get_filepath() . $file->get_filename()
                  ];
                  $path = implode('/', $pathcomponents);
                  return (new moodle_url($path))->out();
              }
          }
          return false;
      }
code_tokens: public static function get_course_image ( $ course ) { global $ CFG ; $ courseinlist = new \ core_course_list_element ( $ course ) ; foreach ( $ courseinlist -> get_course_overviewfiles ( ) as $ file ) { if ( $ file -> is_valid_image ( ) ) { $ pathcomponents = [ '/pluginfile.php' , $ file -> get_contextid ( ) , $ file -> get_component ( ) , $ file -> get_filearea ( ) . $ file -> get_filepath ( ) . $ file -> get_filename ( ) ] ; $ path = implode ( '/' , $ pathcomponents ) ; return ( new moodle_url ( $ path ) ) -> out ( ) ; } } return false ; }
docstring: Get the course image if added to course.
  
  @param object $course
  @return string url of course image
docstring_tokens: Get the course image if added to course .