Documentation

Magnitude
in package

Data structure to handle magnitude type and value

Tags
@return

true, if every check is passed, false otherwise

Table of Contents

Properties

$type  : string
$validTypes  : mixed
$validValues  : mixed
$value  : float

Methods

__construct()  : mixed
__destruct()  : mixed
__toString()  : string
Returns magnitude
type()  : string
Get magnitude type
typeLowerCase()  : string
Get magnitude type in lower case
value()  : float
Get magnitude value
isValidType()  : bool
Check is type is supported
isValidValue()  : bool
Check is value is valid

Properties

$validTypes

private mixed $validTypes = array('ml', 'md', 'mb', 'ms', 'mw', 'mwp')

$validValues

private mixed $validValues = array('min' => -12, 'max' => 12)

Methods

__construct()

public __construct(string $type, float $value) : mixed
Parameters
$type : string
$value : float

__toString()

Returns magnitude

public __toString() : string
Return values
string

Magnitude type and value in "%s %.2f" format

type()

Get magnitude type

public type() : string
Return values
string

Magnitude type

typeLowerCase()

Get magnitude type in lower case

public typeLowerCase() : string
Return values
string

Magnitude type in lowercase

value()

Get magnitude value

public value() : float
Return values
float

Magnitude value

isValidType()

Check is type is supported

private isValidType(string $type) : bool
Parameters
$type : string
Return values
bool

True is supported, false otherwise

isValidValue()

Check is value is valid

private isValidValue(float $value) : bool
Parameters
$value : float
Return values
bool

True is valid, false otherwise


        
On this page

Search results