Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_analytics\model_config Class Reference

Model configuration manager. More...

Public Member Functions

 __construct (?model $model=null)
 Constructor.
 
 check_dependencies (\stdClass $modeldata, bool $ignoreversionmismatches)
 Check that the provided model configuration can be deployed in this site.
 
 export (string $zipfilename, bool $includeweights=true)
 Exports a model to a zip using the provided file name.
 
 extract_import_contents (string $zipfilepath)
 Extracts the import zip contents.
 
 import (string $zipfilepath)
 Imports the provided model configuration into a new model.
 

Static Public Member Functions

static get_class_component (string $fullclassname)
 Returns the component the class belongs to.
 

Public Attributes

const CONFIG_FILE_NAME = 'model-config.json'
 The name of the file where config is held.
 

Protected Member Functions

 export_model_data ()
 Exports the configuration of the model.
 

Detailed Description

Model configuration manager.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_analytics\model_config::__construct ( ?model $model = null)

Constructor.

Parameters
core_analytics\model | null$model

Member Function Documentation

◆ check_dependencies()

core_analytics\model_config::check_dependencies ( \stdClass $modeldata,
bool $ignoreversionmismatches )

Check that the provided model configuration can be deployed in this site.

Parameters
stdClass$modeldata
bool$ignoreversionmismatches
Return values
string|nullError string or null if all good.

◆ export()

core_analytics\model_config::export ( string $zipfilename,
bool $includeweights = true )

Exports a model to a zip using the provided file name.

Parameters
string$zipfilename
bool$includeweightsInclude the model weights if available
Return values
string

◆ export_model_data()

core_analytics\model_config::export_model_data ( )
protected

Exports the configuration of the model.

Return values
stdClass

◆ extract_import_contents()

core_analytics\model_config::extract_import_contents ( string $zipfilepath)

Extracts the import zip contents.

Parameters
string$zipfilepathZip file path
Return values
array[0] => stdClass, [1] => string

◆ get_class_component()

static core_analytics\model_config::get_class_component ( string $fullclassname)
static

Returns the component the class belongs to.

Note that this method does not work for global space classes.

Parameters
string$fullclassnameQualified name including the namespace.
Return values
string|nullFrankenstyle component

◆ import()

core_analytics\model_config::import ( string $zipfilepath)

Imports the provided model configuration into a new model.

Note that this method assumes that self\check_dependencies has already been called.

Parameters
string$zipfilepathPath to the zip file to import
Return values
core_analytics\model

The documentation for this class was generated from the following file: