original_string: public function import(string $zipfilepath) : \core_analytics\model {
  
          list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);
  
          $target = \core_analytics\manager::get_target($modeldata->target);
          $indicators = [];
          foreach ($modeldata->indicators as $indicatorclass) {
              $indicator = \core_analytics\manager::get_indicator($indicatorclass);
              $indicators[$indicator->get_id()] = $indicator;
          }
          $model = \core_analytics\model::create($target, $indicators, $modeldata->timesplitting, $modeldata->processor);
  
          // Import them disabled.
          $model->update(false, false, false, false);
  
          if ($mlbackenddir) {
              $modeldir = $model->get_output_dir(['execution']);
              if (!$model->get_predictions_processor(true)->import($model->get_unique_id(), $modeldir, $mlbackenddir)) {
                  throw new \moodle_exception('errorimport', 'analytics');
              }
              $model->mark_as_trained();
          }
  
          return $model;
      }
code: public function import(string $zipfilepath) : \core_analytics\model {
  
          list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);
  
          $target = \core_analytics\manager::get_target($modeldata->target);
          $indicators = [];
          foreach ($modeldata->indicators as $indicatorclass) {
              $indicator = \core_analytics\manager::get_indicator($indicatorclass);
              $indicators[$indicator->get_id()] = $indicator;
          }
          $model = \core_analytics\model::create($target, $indicators, $modeldata->timesplitting, $modeldata->processor);
  
          // Import them disabled.
          $model->update(false, false, false, false);
  
          if ($mlbackenddir) {
              $modeldir = $model->get_output_dir(['execution']);
              if (!$model->get_predictions_processor(true)->import($model->get_unique_id(), $modeldir, $mlbackenddir)) {
                  throw new \moodle_exception('errorimport', 'analytics');
              }
              $model->mark_as_trained();
          }
  
          return $model;
      }
code_tokens: public function import ( string $ zipfilepath ) : \ core_analytics \ model { list ( $ modeldata , $ mlbackenddir ) = $ this -> extract_import_contents ( $ zipfilepath ) ; $ target = \ core_analytics \ manager :: get_target ( $ modeldata -> target ) ; $ indicators = [ ] ; foreach ( $ modeldata -> indicators as $ indicatorclass ) { $ indicator = \ core_analytics \ manager :: get_indicator ( $ indicatorclass ) ; $ indicators [ $ indicator -> get_id ( ) ] = $ indicator ; } $ model = \ core_analytics \ model :: create ( $ target , $ indicators , $ modeldata -> timesplitting , $ modeldata -> processor ) ; // Import them disabled. $ model -> update ( false , false , false , false ) ; if ( $ mlbackenddir ) { $ modeldir = $ model -> get_output_dir ( [ 'execution' ] ) ; if ( ! $ model -> get_predictions_processor ( true ) -> import ( $ model -> get_unique_id ( ) , $ modeldir , $ mlbackenddir ) ) { throw new \ moodle_exception ( 'errorimport' , 'analytics' ) ; } $ model -> mark_as_trained ( ) ; } return $ model ; }
docstring: Imports the provided model configuration into a new model.
  
  Note that this method assumes that self::check_dependencies has already been called.
  
  @param  string $zipfilepath Path to the zip file to import
  @return \core_analytics\model
docstring_tokens: Imports the provided model configuration into a new model .