class Civi

Class Civi

The "Civi" class provides a facade for accessing major subsystems, such as the service-container and settings manager. It serves as a bridge which allows procedural code to access important objects.

General principles: - Each function provides access to a major subsystem. - Each function performs a simple lookup. - Each function returns an interface. - Whenever possible, interfaces should be well-known (e.g. based on a standard or well-regarded provider).

Properties

static $statics A central location for static variable storage.

Methods

cache(string $name = 'default')

EXPERIMENTAL. Retrieve a named cache instance.

static ContainerInterface
container()

Get the service container.

static EventDispatcherInterface
dispatcher()

Get the event dispatcher.

static LockManager
lockManager()

No description

static LoggerInterface
log()

No description

static Paths
paths()

Obtain the core file/path mapper.

static mixed
service(string $id)

Fetch a service from the container.

static 
reset()

Reset all ephemeral system state, e.g. statics, singletons, containers.

resources()

No description

static SettingsBag
settings(int|null $domainID = NULL)

Obtain the domain settings.

Details

at line 44
static CRM_Utils_Cache_Interface cache(string $name = 'default')

EXPERIMENTAL. Retrieve a named cache instance.

This interface is flagged as experimental due to political ambiguity in PHP community -- PHP-FIG has an open but somewhat controversial draft standard for caching. Based on the current draft, it's expected that this function could simultaneously support both CRM_Utils_Cache_Interface and PSR-6, but that depends on whether PSR-6 changes any more.

Parameters

string $name The name of the cache. The 'default' cache is biased toward high-performance caches (eg memcache/redis/apc) when available and falls back to single-request (static) caching.

Return Value

CRM_Utils_Cache_Interface

at line 53
static ContainerInterface container()

Get the service container.

Return Value

ContainerInterface

at line 62
static EventDispatcherInterface dispatcher()

Get the event dispatcher.

Return Value

EventDispatcherInterface

at line 69
static LockManager lockManager()

Return Value

LockManager

at line 76
static LoggerInterface log()

Return Value

LoggerInterface

at line 85
static Paths paths()

Obtain the core file/path mapper.

Return Value

Paths

at line 96
static mixed service(string $id)

Fetch a service from the container.

Parameters

string $id The service ID.

Return Value

mixed

at line 104
static reset()

Reset all ephemeral system state, e.g. statics, singletons, containers.

at line 112
static CRM_Core_Resources resources()

Return Value

CRM_Core_Resources

at line 123
static SettingsBag settings(int|null $domainID = NULL)

Obtain the domain settings.

Parameters

int|null $domainID For the default domain, leave $domainID as NULL.

Return Value

SettingsBag