public function execute(array $records) : array {
        return array_map(function($record) {
            $contextid = $record->ctxid;
            context_helper::preload_from_record($record);
            $context = context::instance_by_id($contextid);
            return $context;
        }, $records);
    }
public function execute(array $records) : array {
        return array_map(function($record) {
            $contextid = $record->ctxid;
            context_helper::preload_from_record($record);
            $context = context::instance_by_id($contextid);
            return $context;
        }, $records);
    }
public function execute ( array $ records ) : array { return array_map ( function ( $ record ) { $ contextid = $ record -> ctxid ; context_helper :: preload_from_record ( $ record ) ; $ context = context :: instance_by_id ( $ contextid ) ; return $ context ; } , $ records ) ; }
Extract the contexts from a list of records.

@param stdClass[] $records The list of records which have context properties
@return context[] List of contexts matching the records.
Extract the contexts from a list of records .