jProfiles

class to read profiles from the profiles.ini.php

package

jelix

subpackage

utils

Methods

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

clear() 
static

WARNING: it destroy all objects stored in the pool!

create a temporary new profile

createVirtualProfile(string $category, string $name, array|string $params) 
static
Throws
\jException

Arguments

$category

string

the profile category

$name

string

the name of the profile

$params

array|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

load properties of a profile.

get(string $category, string $name = '', boolean $noDefault = false) : array
static

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.

Throws
\jException

Arguments

$category

string

the profile category

$name

string

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

$noDefault

boolean

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

Response

array

properties

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

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

Arguments

$category

string

the profile category

$name

string

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

Response

object|null

the stored 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)

getOrStoreInPool(string $category, string $name, string|array $function,  $nodefault = false) : object|null
static

Arguments

$category

string

the profile category

$name

string

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

$function

string|array

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

$nodefault

Response

object|null

the stored object

loadProfiles

loadProfiles() 
static

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

storeInPool(string $category, string $name,  $object) 
static

Arguments

$category

string

the profile category

$name

string

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

$object

Properties

loaded profiles

_profiles : array
static
var

Type(s)

array

pool of objects loaded for profiles

_objectPool : array
static
var

array of object

Type(s)

array