Jelix 1.7.18

jProfiles
in package

class to read profiles from the profiles.ini.php.

Tags
subpackage

utils

Table of Contents

$_objectPool  : array<string|int, object>
pool of objects loaded for profiles.
$_profiles  : array<string|int, mixed>
loaded profiles.
clear()  : mixed
clear the loaded profiles to force to reload the profiles file.
createVirtualProfile()  : mixed
create a temporary new profile.
get()  : array<string|int, mixed>
load properties of a profile.
getFromPool()  : null|object
get an object from the objects pool, corresponding to a profile.
getOrStoreInPool()  : null|object
add an object in the objects pool, corresponding to a profile or store the object retrieved from the function, which accepts a profile as parameter (array).
storeInPool()  : mixed
add an object in the objects pool, corresponding to a profile.
loadProfiles()  : mixed

Properties

$_objectPool

pool of objects loaded for profiles.

protected static array<string|int, object> $_objectPool = array()

$_profiles

loaded profiles.

protected static array<string|int, mixed> $_profiles

Methods

clear()

clear the loaded profiles to force to reload the profiles file.

public static clear() : mixed

WARNING: it destroy all objects stored in the pool!

Return values
mixed

createVirtualProfile()

create a temporary new profile.

public static createVirtualProfile(string $category, string $name, array<string|int, mixed>|string $params) : mixed
Parameters
$category : string

the profile category

$name : string

the name of the profile

$params : array<string|int, mixed>|string

parameters of the profile. key=parameter name, value=parameter value. we can also indicate a name of an other profile, to create an alias

Tags
throws
jException
Return values
mixed

get()

load properties of a profile.

public static get(string $category[, string $name = '' ][, bool $noDefault = false ]) : array<string|int, mixed>

A profile is a section in the profiles.ini.php file. Profiles are belong to a category. Each section names is composed by "category:profilename".

The given name can be a profile name or an alias of a profile. An alias is a parameter name in the category section of the ini file, and the value of this parameter should be a profile name.

Parameters
$category : string

the profile category

$name : string = ''

profile name or alias of a profile name. if empty, use the default profile

$noDefault : bool = false

if true and if the profile doesn't exist, throw an error instead of getting the default profile

Tags
throws
jException
Return values
array<string|int, mixed>

properties

getFromPool()

get an object from the objects pool, corresponding to a profile.

public static getFromPool(string $category, string $name) : null|object
Parameters
$category : string

the profile category

$name : string

the name of the profile (value of _name in the retrieved profile)

Return values
null|object

the stored object

getOrStoreInPool()

add an object in the objects pool, corresponding to a profile or store the object retrieved from the function, which accepts a profile as parameter (array).

public static getOrStoreInPool(string $category, string $name, array<string|int, mixed>|string $function[, mixed $nodefault = false ]) : null|object
Parameters
$category : string

the profile category

$name : string

the name of the profile (will be given to jProfiles::get)

$function : array<string|int, mixed>|string

the function name called to retrieved the object. It uses call_user_func.

$nodefault : mixed = false
Return values
null|object

the stored object

storeInPool()

add an object in the objects pool, corresponding to a profile.

public static storeInPool(string $category, string $name, mixed $object) : mixed
Parameters
$category : string

the profile category

$name : string

the name of the profile (value of _name in the retrieved profile)

$object : mixed
Return values
mixed

loadProfiles()

protected static loadProfiles() : mixed
Return values
mixed

Search results