Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
core_privacy\local\request\writer Class Reference

The writer factory class used to fetch and work with the content_writer. More...

Static Public Member Functions

static export_user_preference (string $component, string $key, string $value, string $description)
 Export the specified user preference.
 
static reset ()
 Reset the writer and content_writer.
 
static setup_real_writer_instance ()
 Create a real content_writer for use by PHPUnit tests, where a mock writer will not suffice.
 
static with_context (\context $context)
 Provide an instance of the writer with the specified context applied.
 

Protected Member Functions

 __construct ()
 Constructor for the content writer.
 
 get_writer_instance ()
 Singleton to return or create and return a copy of a content_writer.
 

Static Protected Member Functions

static instance ()
 Return an instance of.
 

Protected Attributes

content_writer $realwriter = null
 The current content_writer instance.
 

Static Protected Attributes

static writer $instance = null
 The singleton instance of this writer.
 

Detailed Description

The writer factory class used to fetch and work with the content_writer.

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

Constructor & Destructor Documentation

◆ __construct()

core_privacy\local\request\writer::__construct ( )
protected

Constructor for the content writer.

Protected to prevent direct instantiation.

Member Function Documentation

◆ export_user_preference()

static core_privacy\local\request\writer::export_user_preference ( string $component,
string $key,
string $value,
string $description )
static

Export the specified user preference.

Parameters
string$componentThe name of the component.
string$keyThe name of th key to be exported.
string$valueThe value of the preference
string$descriptionA description of the value
Return values
content_writer

◆ get_writer_instance()

core_privacy\local\request\writer::get_writer_instance ( )
protected

Singleton to return or create and return a copy of a content_writer.

Return values
content_writer

◆ setup_real_writer_instance()

static core_privacy\local\request\writer::setup_real_writer_instance ( )
static

Create a real content_writer for use by PHPUnit tests, where a mock writer will not suffice.

Return values
content_writer

◆ with_context()

static core_privacy\local\request\writer::with_context ( \context $context)
static

Provide an instance of the writer with the specified context applied.

Parameters
context$contextThe context to apply
Return values
content_writerThe content_writer

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