CRM_Utils_PseudoConstant
in package
Utilities for manipulating/inspecting CRM_*_PseudoConstant classes.
Table of Contents
Properties
- $constantClasses : array<string|int, mixed>
- CiviCRM pseudoconstant classes for wrapper functions.
- $constants : array<string|int, mixed>
Methods
- findConstantClass() : string|null
- Determine where a constant lives.
- findConstants() : array<string|int, mixed>
- Scan for a list of pseudo-constants. A pseudo-constant is recognized by listing any static properties which have corresponding static methods.
- findConstantsByClass() : array<string|int, mixed>
- Scan for a list of pseudo-constants. A pseudo-constant is recognized by listing any static properties which have corresponding static methods.
- flushAll() : mixed
- Flush all caches related to pseudo-constants.
- flushConstant() : array<string|int, mixed>
- Flush constant.
- getConstant() : array<string|int, mixed>
- Get constant.
Properties
$constantClasses
CiviCRM pseudoconstant classes for wrapper functions.
private
static array<string|int, mixed>
$constantClasses
= ['CRM_Core_PseudoConstant', 'CRM_Event_PseudoConstant', 'CRM_Contribute_PseudoConstant', 'CRM_Member_PseudoConstant']
$constants
private
static array<string|int, mixed>
$constants
= \NULL
($name => $className)
Methods
findConstantClass()
Determine where a constant lives.
public
static findConstantClass(string $constant) : string|null
If there's a full, preloaded map, use it. Otherwise, use search class space.
Parameters
- $constant : string
-
Constant-name.
Return values
string|null —class-name
findConstants()
Scan for a list of pseudo-constants. A pseudo-constant is recognized by listing any static properties which have corresponding static methods.
public
static findConstants() : array<string|int, mixed>
This may be inefficient and should generally be avoided.
Return values
array<string|int, mixed> —Array of string, constant names
findConstantsByClass()
Scan for a list of pseudo-constants. A pseudo-constant is recognized by listing any static properties which have corresponding static methods.
public
static findConstantsByClass(mixed $class) : array<string|int, mixed>
This may be inefficient and should generally be avoided.
Parameters
- $class : mixed
Return values
array<string|int, mixed> —Array of string, constant names
flushAll()
Flush all caches related to pseudo-constants.
public
static flushAll() : mixed
This may be inefficient and should generally be avoided.
flushConstant()
Flush constant.
public
static flushConstant(mixed $constant) : array<string|int, mixed>
Wrapper for Pseudoconstant methods. We use this so the calling function doesn't need to know which class the Pseudoconstant is on (some are on the Contribute_Pseudoconsant Class etc
Parameters
- $constant : mixed
Return values
array<string|int, mixed> —array reference of all relevant constant
getConstant()
Get constant.
public
static getConstant(string $constant) : array<string|int, mixed>
Wrapper for Pseudoconstant methods. We use this so the calling function doesn't need to know which class the Pseudoconstant is on (some are on the Contribute_Pseudoconstant Class etc
Parameters
- $constant : string
Return values
array<string|int, mixed> —array reference of all relevant constant