original_string: public static function get_published_course($publication) {
          try {
              list($courses, $unused) = api::get_courses('', !$publication->enrollable,
                  $publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
              return reset($courses);
          } catch (\Exception $e) {
              \core\notification::add(get_string('errorcourseinfo', 'hub', $e->getMessage()),
                  \core\output\notification::NOTIFY_ERROR);
          }
          return null;
      }
code: public static function get_published_course($publication) {
          try {
              list($courses, $unused) = api::get_courses('', !$publication->enrollable,
                  $publication->enrollable, ['ids' => [$publication->hubcourseid], 'allsitecourses' => 1]);
              return reset($courses);
          } catch (\Exception $e) {
              \core\notification::add(get_string('errorcourseinfo', 'hub', $e->getMessage()),
                  \core\output\notification::NOTIFY_ERROR);
          }
          return null;
      }
code_tokens: public static function get_published_course ( $ publication ) { try { list ( $ courses , $ unused ) = api :: get_courses ( '' , ! $ publication -> enrollable , $ publication -> enrollable , [ 'ids' => [ $ publication -> hubcourseid ] , 'allsitecourses' => 1 ] ) ; return reset ( $ courses ) ; } catch ( \ Exception $ e ) { \ core \ notification :: add ( get_string ( 'errorcourseinfo' , 'hub' , $ e -> getMessage ( ) ) , \ core \ output \ notification :: NOTIFY_ERROR ) ; } return null ; }
docstring: Retrieves information about published course
  
  For the list of fields returned for the course see {@link communication::get_courses}
  
  @param stdClass $publication
  @return array|null
docstring_tokens: Retrieves information about published course