Elgg  Version master
Static Public Member Functions | List of all members
Elgg\Values Class Reference

Functions for use as event handlers or other situations where you need a globally accessible callable. More...

Static Public Member Functions

static getTrue ()
 Return true. More...
 
static getFalse ()
 Return false. More...
 
static getNull ()
 Return null. More...
 
static getArray ()
 Return empty array. More...
 
static normalizeTimestamp ($time)
 Returns timestamp value of the time representation. More...
 
static normalizeTime ($time)
 Returns DateTime object based on time representation. More...
 
static normalizeIds (...$args)
 Prepare IDs. More...
 
static normalizeGuids (...$args)
 Flatten an array of data into an array of GUIDs. More...
 
static preventViewOutput ()
 Return array with __view_output set to prevent view output during view_vars event. More...
 
static isEmpty ($value)
 Check if a value isn't empty, but allow 0 and '0'. More...
 
static shortFormatOutput ($n, $precision=0)
 Use to convert large positive numbers in to short form like 1K, 1M, 1B or 1T Example: shortFormatOutput(7201); // Output: 7K Example: shortFormatOutput(7201,1); // Output: 7.2K. More...
 

Detailed Description

Functions for use as event handlers or other situations where you need a globally accessible callable.

Definition at line 13 of file Values.php.

Member Function Documentation

static Elgg\Values::getArray ( )
static

Return empty array.

Returns
array
Since
1.12.0

Definition at line 51 of file Values.php.

static Elgg\Values::getFalse ( )
static

Return false.

Returns
false
Since
1.12.0

Definition at line 31 of file Values.php.

static Elgg\Values::getNull ( )
static

Return null.

Returns
null
Since
1.12.0

Definition at line 41 of file Values.php.

static Elgg\Values::getTrue ( )
static

Return true.

Returns
true
Since
1.12.0

Definition at line 21 of file Values.php.

static Elgg\Values::isEmpty (   $value)
static

Check if a value isn't empty, but allow 0 and '0'.

Parameters
mixed$valuethe value to check
See also
empty()
Returns
bool
Since
3.0.0

Definition at line 192 of file Values.php.

static Elgg\Values::normalizeGuids (   $args)
static

Flatten an array of data into an array of GUIDs.

Parameters
mixed...$args Elements to normalize
Returns
int[]|null
Exceptions
DataFormatException

Definition at line 141 of file Values.php.

static Elgg\Values::normalizeIds (   $args)
static

Prepare IDs.

Parameters
array...$args IDs
Returns
int[]
Exceptions
DataFormatException

Definition at line 104 of file Values.php.

static Elgg\Values::normalizeTime (   $time)
static

Returns DateTime object based on time representation.

Parameters
\DateTime | \Elgg\I18n\DateTime | string | int$timeTime
Returns
Exceptions
DataFormatException

Definition at line 75 of file Values.php.

static Elgg\Values::normalizeTimestamp (   $time)
static

Returns timestamp value of the time representation.

Parameters
\DateTime | \Elgg\I18n\DateTime | string | int$timeTime
Returns
int
Exceptions
DataFormatException

Definition at line 63 of file Values.php.

static Elgg\Values::preventViewOutput ( )
static

Return array with __view_output set to prevent view output during view_vars event.

See also
ViewsService->renderView()
Returns
array
Since
3.0

Definition at line 178 of file Values.php.

static Elgg\Values::shortFormatOutput (   $n,
  $precision = 0 
)
static

Use to convert large positive numbers in to short form like 1K, 1M, 1B or 1T Example: shortFormatOutput(7201); // Output: 7K Example: shortFormatOutput(7201,1); // Output: 7.2K.

Parameters
mixed$ninput integer or string
int$precisionnumber of digits in decimal place (default = 0)
Returns
string|int
Since
3.1

Definition at line 211 of file Values.php.


The documentation for this class was generated from the following file: