original_string: public function get_contexts_from_consumer(ToolConsumer $consumer) {
          global $DB;
  
          $contexts = [];
          $contextrecords = $DB->get_records($this->contexttable, ['consumerid' => $consumer->getRecordId()], '', 'lticontextkey');
          foreach ($contextrecords as $record) {
              $context = Context::fromConsumer($consumer, $record->lticontextkey);
              $contexts[] = $context;
          }
  
          return $contexts;
      }
code: public function get_contexts_from_consumer(ToolConsumer $consumer) {
          global $DB;
  
          $contexts = [];
          $contextrecords = $DB->get_records($this->contexttable, ['consumerid' => $consumer->getRecordId()], '', 'lticontextkey');
          foreach ($contextrecords as $record) {
              $context = Context::fromConsumer($consumer, $record->lticontextkey);
              $contexts[] = $context;
          }
  
          return $contexts;
      }
code_tokens: public function get_contexts_from_consumer ( ToolConsumer $ consumer ) { global $ DB ; $ contexts = [ ] ; $ contextrecords = $ DB -> get_records ( $ this -> contexttable , [ 'consumerid' => $ consumer -> getRecordId ( ) ] , '' , 'lticontextkey' ) ; foreach ( $ contextrecords as $ record ) { $ context = Context :: fromConsumer ( $ consumer , $ record -> lticontextkey ) ; $ contexts [ ] = $ context ; } return $ contexts ; }
docstring: Fetches the list of Context objects that are linked to a ToolConsumer.
  
  @param ToolConsumer $consumer
  @return Context[]
docstring_tokens: Fetches the list of Context objects that are linked to a ToolConsumer .