MIDDAG for Moodle

item_types

FinalYes

TYPE registry for Domain Items.

Maps: string TYPE → class-string.

Central registry for all ITEM TYPE ↔ CLASS mappings. It is final and static-only to serve as a global lookup point.

Table of Contents

Properties

$item_types_map  : array<string, item>>

Methods

all()  : array<string, item>>
Return all registered TYPEs.
class_for()  : item>
Get the class associated with a TYPE.
is_registered()  : bool
Check if a TYPE has been registered.
register()  : void
Register a TYPE → class mapping.
register_core_types()  : void
Register core built-in types.
__construct()  : mixed
Private constructor to prevent instantiation.

Properties

$item_types_map

private static array<string, item>> $item_types_map = []

Methods

all()

Return all registered TYPEs.

public static all() : array<string, item>>
Return values
array<string, item>>

class_for()

Get the class associated with a TYPE.

public static class_for(string $type) : item>
Parameters
$type : string
Tags
throws
coding_exception

if type is not registered

Return values
item>

is_registered()

Check if a TYPE has been registered.

public static is_registered(string $type) : bool
Parameters
$type : string
Return values
bool

register()

Register a TYPE → class mapping.

public static register(string $type, item> $classname) : void
Parameters
$type : string

the unique string identifier for the type

$classname : item>

the fully qualified class name extending Item

Tags
throws
coding_exception

register_core_types()

Register core built-in types.

public static register_core_types() : void

Called automatically by kernel/bootstrap.

Tags
throws
coding_exception

__construct()

Private constructor to prevent instantiation.

private __construct() : mixed

        
On this page

Search results