original_string: public function extract_import_contents(string $zipfilepath) : array {
  
          $importtempdir = make_request_directory('analyticsimport' . microtime(false));
  
          $zip = new \zip_packer();
          $filelist = $zip->extract_to_pathname($zipfilepath, $importtempdir);
  
          if (empty($filelist[self::CONFIG_FILE_NAME])) {
              // Missing required file.
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          $jsonmodeldata = file_get_contents($importtempdir . DIRECTORY_SEPARATOR . self::CONFIG_FILE_NAME);
  
          if (!$modeldata = json_decode($jsonmodeldata)) {
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          if (empty($modeldata->target) || empty($modeldata->timesplitting) || empty($modeldata->indicators)) {
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          $mlbackenddir = $importtempdir . DIRECTORY_SEPARATOR . 'mlbackend';
          if (!is_dir($mlbackenddir)) {
              $mlbackenddir = false;
          }
  
          return [$modeldata, $mlbackenddir];
      }
code: public function extract_import_contents(string $zipfilepath) : array {
  
          $importtempdir = make_request_directory('analyticsimport' . microtime(false));
  
          $zip = new \zip_packer();
          $filelist = $zip->extract_to_pathname($zipfilepath, $importtempdir);
  
          if (empty($filelist[self::CONFIG_FILE_NAME])) {
              // Missing required file.
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          $jsonmodeldata = file_get_contents($importtempdir . DIRECTORY_SEPARATOR . self::CONFIG_FILE_NAME);
  
          if (!$modeldata = json_decode($jsonmodeldata)) {
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          if (empty($modeldata->target) || empty($modeldata->timesplitting) || empty($modeldata->indicators)) {
              throw new \moodle_exception('errorimport', 'analytics');
          }
  
          $mlbackenddir = $importtempdir . DIRECTORY_SEPARATOR . 'mlbackend';
          if (!is_dir($mlbackenddir)) {
              $mlbackenddir = false;
          }
  
          return [$modeldata, $mlbackenddir];
      }
code_tokens: public function extract_import_contents ( string $ zipfilepath ) : array { $ importtempdir = make_request_directory ( 'analyticsimport' . microtime ( false ) ) ; $ zip = new \ zip_packer ( ) ; $ filelist = $ zip -> extract_to_pathname ( $ zipfilepath , $ importtempdir ) ; if ( empty ( $ filelist [ self :: CONFIG_FILE_NAME ] ) ) { // Missing required file. throw new \ moodle_exception ( 'errorimport' , 'analytics' ) ; } $ jsonmodeldata = file_get_contents ( $ importtempdir . DIRECTORY_SEPARATOR . self :: CONFIG_FILE_NAME ) ; if ( ! $ modeldata = json_decode ( $ jsonmodeldata ) ) { throw new \ moodle_exception ( 'errorimport' , 'analytics' ) ; } if ( empty ( $ modeldata -> target ) || empty ( $ modeldata -> timesplitting ) || empty ( $ modeldata -> indicators ) ) { throw new \ moodle_exception ( 'errorimport' , 'analytics' ) ; } $ mlbackenddir = $ importtempdir . DIRECTORY_SEPARATOR . 'mlbackend' ; if ( ! is_dir ( $ mlbackenddir ) ) { $ mlbackenddir = false ; } return [ $ modeldata , $ mlbackenddir ] ; }
docstring: Extracts the import zip contents.
  
  @param  string $zipfilepath Zip file path
  @return array [0] => \stdClass, [1] => string
docstring_tokens: Extracts the import zip contents .