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

Public Member Functions

 __construct ($identifier, $component='', $a=null, $lang=null)
 Constructs a lang_string object. More...
 
 __set_state ()
 Magic __set_state method used for var_export. More...
 
 __sleep ()
 Prepares the lang_string for sleep and stores only the forcedstring and string properties... the string cannot be regenerated so we need to ensure it is generated for this. More...
 
 __toString ()
 Magic __toString method for printing a string. More...
 
 get_component ()
 Returns the component. More...
 
 get_identifier ()
 Returns the identifier. More...
 
 out ($lang=null)
 Returns the string. More...
 

Protected Member Functions

 get_string ()
 Processes the string. More...
 

Protected Attributes

array stdClass $a = null
 Any arguments required for the string. More...
 
string $component = ''
 The strings component. More...
 
bool $forcedstring = false
 A special boolean. More...
 
string $identifier
 The strings identifier.
 
string $lang = null
 The language to use when processing the string. More...
 
string $string = null
 The processed string (once processed)
 

Constructor & Destructor Documentation

◆ __construct()

lang_string::__construct (   $identifier,
  $component = '',
  $a = null,
  $lang = null 
)

Constructs a lang_string object.

This function should do as little processing as possible to ensure the best performance for strings that won't be used.

Parameters
string$identifierThe strings identifier
string$componentThe strings component
stdClass | array$aAny arguments the string requires
string$langThe language to use when processing the string.
Exceptions
coding_exception

Member Function Documentation

◆ __set_state()

lang_string::__set_state ( )

Magic __set_state method used for var_export.

Return values
string

◆ __sleep()

lang_string::__sleep ( )

Prepares the lang_string for sleep and stores only the forcedstring and string properties... the string cannot be regenerated so we need to ensure it is generated for this.

Return values
string

◆ __toString()

lang_string::__toString ( )

Magic __toString method for printing a string.

Return values
string

◆ get_component()

lang_string::get_component ( )

Returns the component.

Return values
string

◆ get_identifier()

lang_string::get_identifier ( )

Returns the identifier.

Return values
string

◆ get_string()

lang_string::get_string ( )
protected

Processes the string.

This function actually processes the string, stores it in the string property and then returns it. You will notice that this function is VERY similar to the get_string method. That is because it is pretty much doing the same thing. However as this function is an upgrade it isn't as tolerant to backwards compatibility.

Return values
string
Exceptions
coding_exception

◆ out()

lang_string::out (   $lang = null)

Returns the string.

Parameters
string$langThe langauge to use when processing the string
Return values
string

Member Data Documentation

◆ $a

array stdClass lang_string::$a = null
protected

Any arguments required for the string.

Default null

◆ $component

string lang_string::$component = ''
protected

The strings component.

Default ''

◆ $forcedstring

bool lang_string::$forcedstring = false
protected

A special boolean.

If set to true then the object has been woken up and cannot be regenerated. If this is set then $this->string MUST be used.

◆ $lang

string lang_string::$lang = null
protected

The language to use when processing the string.

Default null


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