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;
    }
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;
    }
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 ; }
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
Retrieves information about published course