PHP Class JBZoo\SimpleTypes\Formatter

Show file Open project: jbzoo/simpletypes Class Usage Examples

Protected Properties

Property Type Description
$_default array
$_rules array
$_type string | null

Public Methods

Method Description
__construct ( array $rules = [], array $default = [], string $type = null )
addRule ( string $rule, array $newFormat = [] )
changeRule ( string $rule, array $newFormat )
get ( string $rule ) : array
getList ( boolean $keysOnly = false ) : array
html ( array $current, array $orig, array $params ) : string
htmlAttributes ( array $attributes ) : string
htmlInput ( array $current, array $orig, array $params ) : string
removeRule ( string $rule ) : boolean
round ( float $value, string $rule, array $params = [] ) : float
text ( float $value, string $rule, boolean $showSymbol = true ) : mixed | string

Protected Methods

Method Description
_format ( float $value, string $rule ) : array Convert value to money format from config

Method Details

__construct() public method

public __construct ( array $rules = [], array $default = [], string $type = null )
$rules array
$default array
$type string

_format() protected method

Convert value to money format from config
protected _format ( float $value, string $rule ) : array
$value float
$rule string
return array

addRule() public method

public addRule ( string $rule, array $newFormat = [] )
$rule string
$newFormat array

changeRule() public method

public changeRule ( string $rule, array $newFormat )
$rule string
$newFormat array

get() public method

public get ( string $rule ) : array
$rule string
return array

getList() public method

public getList ( boolean $keysOnly = false ) : array
$keysOnly boolean
return array

html() public method

public html ( array $current, array $orig, array $params ) : string
$current array
$orig array
$params array
return string

htmlAttributes() public method

public htmlAttributes ( array $attributes ) : string
$attributes array
return string

htmlInput() public method

public htmlInput ( array $current, array $orig, array $params ) : string
$current array
$orig array
$params array
return string

removeRule() public method

public removeRule ( string $rule ) : boolean
$rule string
return boolean

round() public method

public round ( float $value, string $rule, array $params = [] ) : float
$value float
$rule string
$params array
return float

text() public method

public text ( float $value, string $rule, boolean $showSymbol = true ) : mixed | string
$value float
$rule string
$showSymbol boolean
return mixed | string

Property Details

$_default protected property

protected array $_default
return array

$_rules protected property

protected array $_rules
return array

$_type protected property

protected string|null $_type
return string | null