Class NumberHelper
Number helper library.
Methods to make numbers more readable.
- AppHelper
- NumberHelper
Package: Cake\View\Helper
Link: http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html
See:
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/View/Helper/NumberHelper.php
Link: http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html
See:
CakeNumber
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/View/Helper/NumberHelper.php
Properties summary
-
$_engine
protectedCakeNumber instance
Method Summary
-
__call() public
Call methods from CakeNumber utility class -
__construct() public
Default Constructor -
addFormat() public
-
currency() public
-
format() public
-
precision() public
-
toPercentage() public
-
toReadableSize() public
Method Detail
__construct() public ¶
__construct( View
$View , array $settings = array() )
Default Constructor
Settings:
engine
Class name to use to replace CakeNumber functionality The class needs to be placed in theUtility
directory.
Parameters
-
View
$View - The View this helper is being attached to.
- array $settings optional array()
- Configuration settings for the helper
Throws
addFormat() public ¶
addFormat( string $formatName , array $options )
Parameters
- string $formatName
- The format name to be used in the future.
- array $options
- The array of options for this format.
See:
CakeNumber::addFormat()
See
NumberHelper::currency()
Link
currency() public ¶
currency( float $number , string $currency = 'USD' , array $options = array() )
Parameters
- float $number
- string $currency optional 'USD'
Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise set at least 'before' and 'after' options.
- array $options optional array()
Returns
string
Number formatted as a currency.
Number formatted as a currency.
See:
CakeNumber::currency()
Link
format() public ¶
format( float $number , integer $options = false )
Parameters
- float $number
- A floating point number
- integer $options optional false
if int then places, if string then before, if (,.-) then use it or array with places and before keys
Returns
string
formatted number
formatted number
See:
CakeNumber::format()
Link
precision() public ¶
precision( float $number , integer $precision = 3 )
Parameters
- float $number
- A floating point number.
- integer $precision optional 3
- The precision of the returned number.
Returns
float
Formatted float.
Formatted float.
See:
CakeNumber::precision()
Link
toPercentage() public ¶
toPercentage( float $number , integer $precision = 2 )
Parameters
- float $number
- A floating point number
- integer $precision optional 2
- The precision of the returned number
Returns
string
Percentage string
Percentage string
See:
CakeNumber::toPercentage()
Link
toReadableSize() public ¶
toReadableSize( integer $size )
Parameters
- integer $size
- Size in bytes
Returns
string
Human readable size
Human readable size
See:
CakeNumber::toReadableSize()