public function get_contexts() : array {
        $contexts = [];
        foreach ($this->contextids as $contextid) {
            // It is possible that this context has been deleted and we now have subsequent calls being made with this
            // contextlist. Exceptions here will stop the further processing of this component and that is why we are
            // doing a try catch.
            try {
                $contexts[] = \context::instance_by_id($contextid);
            } catch (\Exception $e) {
                // Remove this context.
                unset($this->contextids[$this->iteratorposition]);
            }
        }

        return $contexts;
    }
public function get_contexts() : array {
        $contexts = [];
        foreach ($this->contextids as $contextid) {
            // It is possible that this context has been deleted and we now have subsequent calls being made with this
            // contextlist. Exceptions here will stop the further processing of this component and that is why we are
            // doing a try catch.
            try {
                $contexts[] = \context::instance_by_id($contextid);
            } catch (\Exception $e) {
                // Remove this context.
                unset($this->contextids[$this->iteratorposition]);
            }
        }

        return $contexts;
    }
public function get_contexts ( ) : array { $ contexts = [ ] ; foreach ( $ this -> contextids as $ contextid ) { // It is possible that this context has been deleted and we now have subsequent calls being made with this // contextlist. Exceptions here will stop the further processing of this component and that is why we are // doing a try catch. try { $ contexts [ ] = \ context :: instance_by_id ( $ contextid ) ; } catch ( \ Exception $ e ) { // Remove this context. unset ( $ this -> contextids [ $ this -> iteratorposition ] ) ; } } return $ contexts ; }
Get the complete list of context objects that relate to this
request.

@return  \context[]
Get the complete list of context objects that relate to this request .