Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
core_analytics\model_config Class Reference

Model configuration manager. More...

Public Member Functions

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

Static Public Member Functions

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

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. More...
 

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: