private function get_context_courseid(\context $context) {

        if (empty($this->contextcourseids[$context->id])) {

            $coursecontext = $context->get_course_context(false);
            if (!$coursecontext) {
                // Default to the frontpage course context.
                $coursecontext = \context_course::instance(SITEID);
            }
            $this->contextcourseids[$context->id] = $coursecontext->instanceid;
        }

        return $this->contextcourseids[$context->id];
    }
private function get_context_courseid(\context $context) {

        if (empty($this->contextcourseids[$context->id])) {

            $coursecontext = $context->get_course_context(false);
            if (!$coursecontext) {
                // Default to the frontpage course context.
                $coursecontext = \context_course::instance(SITEID);
            }
            $this->contextcourseids[$context->id] = $coursecontext->instanceid;
        }

        return $this->contextcourseids[$context->id];
    }
private function get_context_courseid ( \ context $ context ) { if ( empty ( $ this -> contextcourseids [ $ context -> id ] ) ) { $ coursecontext = $ context -> get_course_context ( false ) ; if ( ! $ coursecontext ) { // Default to the frontpage course context. $ coursecontext = \ context_course :: instance ( SITEID ) ; } $ this -> contextcourseids [ $ context -> id ] = $ coursecontext -> instanceid ; } return $ this -> contextcourseids [ $ context -> id ] ; }
Returns the course context of the provided context reading an internal cache first.

@param  \context $context
@return int
Returns the course context of the provided context reading an internal cache first .