original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Get the complete list of context objects that relate to this
  request.
  
  @return  \context[]
docstring_tokens: Get the complete list of context objects that relate to this request .