Class for general utility functions and access to general utility classes.

As these classes may need setting of values this subclass implements the checkRegistryRequestsAnswers() easy access to resources.

package Gems
subpackage Util
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.0
inherited_from \Gems_Loader_TargetLoaderAbstract

 Methods

__construct()

__construct(mixed $container, array $dirs) 
Inherited

Parameters

$container

mixed

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__get()

__get($name) 
Inherited

Parameters

$name

Add prefixed paths to the registry of paths

addPrefixPath(string $prefix, $path, boolean $prepend = true) : \Gems_Loader_LoaderAbstract
Inherited

Parameters

$prefix

string

$path

$prepend

boolean

Put path at the beginning of the stack (has no effect when prefix / dir already set)

Returns

\Gems_Loader_LoaderAbstract(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

Allows the loader to set resources.

answerRegistryRequest(string $name, mixed $resource) : boolean
Inherited

Parameters

$name

string

Name of resource to set

$resource

mixed

The resource.

Returns

booleanTrue if $resource was OK

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean
Inherited

Returns

booleanFalse if required values are missing.

Returns a single consent code object.

getConsent(string $description) : \Gems\Util\ConsentCode

Parameters

$description

string

Returns

\Gems\Util\ConsentCode

Retrieve the consentCODE to use for rejected responses by the survey system The mapping of actual consents to consentCODEs is done in the gems__consents table

getConsentRejected() : string

Exceptions

\Gems_Exception_Coding

Returns

stringDefault value is 'do not use'

Retrieve the array of possible consentCODEs to use for responses by the survey system The mapping of actual consents to consentCODEs is done in the gems__consents table

getConsentTypes() : array

Returns

arrayDefault consent codes are 'do not use' and 'consent given'

Get the code for an unknwon user consent

getConsentUnknown() : string

This is de consent description from gems__consents, not the consentCODE

Returns

string

Returns the cron job lock

getCronJobLock() : \Gems_Util_LockFile

Returns

\Gems_Util_LockFile

Returns the current 'base site' url, optionally with a subpath.

getCurrentURI(string $subpath = '') : string
staticvar string $uri

Parameters

$subpath

string

Optional string

Returns

stringThe Url + basePath plus the optional subpath

getDbLookup()

getDbLookup() : \Gems_Util_DbLookup

Returns

\Gems_Util_DbLookup

Get the default user consent

getDefaultConsent() : string

This is de consent description from gems__consents, not the consentCODE

Returns

string

getImageUri()

getImageUri($imageFile) 

Parameters

$imageFile

getLocalized()

getLocalized() : \Gems_Util_Localized

Returns

\Gems_Util_Localized

Returns the maintenance lock

getMaintenanceLock() : \Gems_Util_LockFile

Returns

\Gems_Util_LockFile

Returns the job monitor

getMonitor() : \Gems\Util\Monitor

Returns

\Gems\Util\Monitor

Returns a single reception code object.

getReceptionCode(string $code) : \Gems_Util_ReceptionCode

Parameters

$code

string

Returns

\Gems_Util_ReceptionCode

Returns a

getReceptionCodeLibrary() : \Gems_Util_ReceptionCodeLibrary

Returns

\Gems_Util_ReceptionCodeLibrary

Allows the loader to know the resources to set.

getRegistryRequests() : array
Inherited

Returns those object variables defined by the subclass but not at the level of this definition.

Can be overruled.

Returns

arrayof string names

getRequestCache()

getRequestCache(string $sourceAction = null, boolean $readonly = false) : \Gems_Util_RequestCache

Parameters

$sourceAction

string

The action to get the cache from if not the current one.

$readonly

boolean

Optional, tell the cache not to store any new values

Returns

\Gems_Util_RequestCache

getTokenData()

getTokenData() : \Gems_Util_TokenData

Returns

\Gems_Util_TokenData

getTrackData()

getTrackData() : \Gems_Util_TrackData

Returns

\Gems_Util_TrackData

getTranslated()

getTranslated() : \Gems_Util_Translated

Returns

\Gems_Util_Translated

Checks if a given IP is allowed according to a set of IP addresses / ranges.

isAllowedIP(string $ip, string $ipRanges = "") : boolean

Multiple addresses/ranges are separated by a colon, an individual range takes the form of 10.0.0.0-10.0.0.255 (subnet masks are not supported)

Parameters

$ip

string

$ipRanges

string

Returns

boolean

Add a subdirectory / sub name to a list of class load paths

_cascadedDirs(array $dirs, string $cascade, boolean $fullClassnameFallback = true) : array
Inherited

Parameters

$dirs

array

prefix => path

$cascade

string

The sub directories to cascade to

$fullClassnameFallback

boolean

Allows full class name specification instead of just plugin name part

Returns

arrayprefix => path

Returns $this->$name, creating the item if it does not yet exist.

_getClass(string $name, string $className = null, array $arguments = array()) : mixed
Inherited

Parameters

$name

string

The $name of the variable to store this object in.

$className

string

Class name or null if the same as $name, prepending $this->_dirs.

$arguments

array

Class initialization arguments.

Returns

mixedInstance of $className

Create or loads the class. When only loading, this function returns a StaticCall object that can be invoked lazely.

_loadClass(string $name, boolean $create = false, array $arguments = array()) : mixed
Inherited
see
see

Parameters

$name

string

The class name, minus the part in $this->_dirs.

$create

boolean

Create the object, or only when an \MUtil_Registry_TargetInterface instance.

$arguments

array

Class initialization arguments.

Returns

mixedA class instance or a \MUtil_Lazy_StaticCall object

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

 Properties

 

The prefix/path location to look for classes.

$_dirs : array

Default

The standard value is

  • => application/classes
  • Gems => library/Gems/classes

But an alternative could be:

  • Demopulse => application/classes
  • Pulse => application/classes
  • Gems => library/Gems/classes
 

$_loader

$_loader : \MUtil_Loader_PluginLoader

Default

 

$basepath

$basepath : \Gems_Util_BasePath

Default

 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

'Util'
 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

null
 

$dbLookup

$dbLookup : \Gems_Util_DbLookup

Default

 

$localized

$localized : \Gems_Util_Localized

Default

 

$monitor

$monitor : \Gems\Util\Monitor

Default

 

$project

$project : \Gems_Project_ProjectSettings

Default

 

$receptionCodeLibrary

$receptionCodeLibrary : \Gems_Util_ReceptionCodeLibrary

Default

 

$requestCache

$requestCache : \Gems_Util_RequestCache

Default

 

$tokenData

$tokenData : \Gems_Util_TokenData

Default

 

$trackData

$trackData : \Gems_Util_TrackData

Default

 

$translated

$translated : \Gems_Util_Translated

Default