Drupal 8  8.0.2
Number Class Reference

Static Public Member Functions

static validStep ($value, $step, $offset=0.0)
 
static intToAlphadecimal ($i=0)
 
static alphadecimalToInt ($string= '00')
 

Detailed Description

Provides helper methods for manipulating numbers.

Member Function Documentation

static alphadecimalToInt (   $string = '00')
static

Decodes a sorting code back to an integer.

Parameters
string$stringThe alpha decimal value to convert
Returns
int The integer value.
See Also
::intToAlphadecimal

Referenced by Comment\preSave(), and NumberTest\testConversions().

Here is the caller graph for this function:

static intToAlphadecimal (   $i = 0)
static

Generates a sorting code from an integer.

Consists of a leading character indicating length, followed by N digits with a numerical value in base 36 (alphadecimal). These codes can be sorted as strings without altering numerical order.

It goes: 00, 01, 02, ..., 0y, 0z, 110, 111, ... , 1zy, 1zz, 2100, 2101, ..., 2zzy, 2zzz, 31000, 31001, ...

Parameters
int$iThe integer value to convert.
Returns
string The alpha decimal value.
See Also
::alphadecimalToInt

Referenced by Comment\preSave(), and NumberTest\testConversions().

Here is the caller graph for this function:

static validStep (   $value,
  $step,
  $offset = 0.0 
)
static

Verifies that a number is a multiple of a given step.

The implementation assumes it is dealing with IEEE 754 double precision floating point numbers that are used by PHP on most systems.

This is based on the number/range verification methods of webkit.

Parameters
float$valueThe value that needs to be checked.
float$stepThe step scale factor. Must be positive.
float$offset(optional) An offset, to which the difference must be a multiple of the given step.
Returns
bool TRUE if no step mismatch has occurred, or FALSE otherwise.
See Also
http://opensource.apple.com/source/WebCore/WebCore-1298/html/NumberInputType.cpp

Referenced by NumberTest\testValidStep(), and NumberTest\testValidStepOffset().

Here is the caller graph for this function:


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