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, int $decimals=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...
 
static numberFormat (float $number, int $decimals=0)
 Format a number with grouped thousands using language specific separators. More...
 

Detailed Description

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

Definition at line 12 of file Values.php.

Member Function Documentation

◆ getArray()

static Elgg\Values::getArray ( )
static

Return empty array.

Returns
array
Since
1.12.0

Definition at line 50 of file Values.php.

◆ getFalse()

static Elgg\Values::getFalse ( )
static

Return false.

Returns
false
Since
1.12.0

Definition at line 30 of file Values.php.

◆ getNull()

static Elgg\Values::getNull ( )
static

Return null.

Returns
null
Since
1.12.0

Definition at line 40 of file Values.php.

◆ getTrue()

static Elgg\Values::getTrue ( )
static

Return true.

Returns
true
Since
1.12.0

Definition at line 20 of file Values.php.

◆ isEmpty()

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 191 of file Values.php.

◆ normalizeGuids()

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 140 of file Values.php.

◆ normalizeIds()

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

Prepare IDs.

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

Definition at line 103 of file Values.php.

◆ normalizeTime()

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

Returns DateTime object based on time representation.

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

Definition at line 74 of file Values.php.

◆ normalizeTimestamp()

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

Returns timestamp value of the time representation.

Parameters
\DateTimeInterface | string | int$timeTime
Returns
int
Exceptions
DataFormatException

Definition at line 62 of file Values.php.

◆ numberFormat()

static Elgg\Values::numberFormat ( float  $number,
int  $decimals = 0 
)
static

Format a number with grouped thousands using language specific separators.

Parameters
float$numberThe number being formatted
int$decimals(optional) Sets the number of decimal points
Returns
string
Since
6.3
See also
number_format()

Definition at line 267 of file Values.php.

◆ preventViewOutput()

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 177 of file Values.php.

◆ shortFormatOutput()

static Elgg\Values::shortFormatOutput (   $n,
int  $decimals = 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$decimalsnumber of digits in decimal place (default = 0)
Returns
string|int
Since
3.1

Definition at line 210 of file Values.php.


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