UnitInterface
Interface for the unit of measurement abstract class.
Tags
Table of Contents
- addFormula() : void
- Add a new formula to the unit.
- addFormulae() : void
- Add multiple formulae to the unit.
- getBase() : UnitInterface
- Returns the unit class that this unit is based off of.
- getBaseUnits() : float
- Returns the units base unit units'.
- getFormulaFor() : null|FormulaInterface
- Return a unit's conversion formula, if it has one.
- getName() : string
- Returns the full symantic name of the unit.
- getRegistryKey() : string|null
- Returns the unit's registry key.
- getScientificSymbol() : string
- Returns the symbol notation of the unit.
- getSymbol() : string
- Returns the symbol notation of the unit.
- getUnitOf() : string
- Returns the type of measurement that this unit is measuring.
- getUnits() : float
- Returns the amount of base units required to make up 1 of the unit.
- getValue() : int|float|string
- Returns the unit's numeric value (how many of it there are).
- isMultipleSiUnit() : bool
- Is the unit an SI multiple unit?
- isSiUnit() : bool
- Is the unit an SI base unit?
- isSubmultipleSiUnit() : bool
- Is the unit an SI submultiple unit?
- setBase() : UnitInterface
- Sets the unit class that this unit is based off of.
- setName() : UnitInterface
- Sets the units full symantic name.
- setScientificSymbol() : UnitInterface
- Sets the unicode scientific symbol notation used for the unit.
- setSymbol() : UnitInterface
- Sets the symbol notation used for the unit.
- setUnitOf() : UnitInterface
- Sets the type of measurement that this unit is measuring.
- setUnits() : UnitInterface
- Sets the amount of base units required to make up 1 of the unit.
- setValue() : UnitInterface
- Sets the unit's numeric value (how many of it are there?).
Methods
addFormula()
Add a new formula to the unit.
public
addFormula(string $symbol, string $class) : void
Parameters
- $symbol : string
-
The symbol of the unit to use for identifying the formula.
- $class : string
-
The class name (FQCN) of formula implementation.
Return values
void —addFormulae()
Add multiple formulae to the unit.
public
addFormulae(array<string|int, mixed> $formulae) : void
Parameters
- $formulae : array<string|int, mixed>
-
An associative array containing the symbol & class.
Return values
void —getBase()
Returns the unit class that this unit is based off of.
public
getBase() : UnitInterface
Return values
UnitInterface —getBaseUnits()
Returns the units base unit units'.
public
getBaseUnits() : float
Return values
float —getFormulaFor()
Return a unit's conversion formula, if it has one.
public
getFormulaFor(UnitInterface $to) : null|FormulaInterface
Parameters
- $to : UnitInterface
-
The unit being converted to.
Return values
null|FormulaInterface —getName()
Returns the full symantic name of the unit.
public
getName() : string
Return values
string —getRegistryKey()
Returns the unit's registry key.
public
getRegistryKey() : string|null
Return values
string|null —getScientificSymbol()
Returns the symbol notation of the unit.
public
getScientificSymbol() : string
Return values
string —getSymbol()
Returns the symbol notation of the unit.
public
getSymbol() : string
Return values
string —getUnitOf()
Returns the type of measurement that this unit is measuring.
public
getUnitOf() : string
Return values
string —getUnits()
Returns the amount of base units required to make up 1 of the unit.
public
getUnits() : float
Return values
float —getValue()
Returns the unit's numeric value (how many of it there are).
public
getValue() : int|float|string
Return values
int|float|string —isMultipleSiUnit()
Is the unit an SI multiple unit?
public
isMultipleSiUnit() : bool
Return values
bool —isSiUnit()
Is the unit an SI base unit?
public
isSiUnit() : bool
Return values
bool —isSubmultipleSiUnit()
Is the unit an SI submultiple unit?
public
isSubmultipleSiUnit() : bool
Return values
bool —setBase()
Sets the unit class that this unit is based off of.
public
setBase(mixed $base) : UnitInterface
Parameters
- $base : mixed
-
The class that the unit is based on.
Tags
Return values
UnitInterface —setName()
Sets the units full symantic name.
public
setName(string $name) : UnitInterface
Parameters
- $name : string
-
The value to be set as the units name
Return values
UnitInterface —setScientificSymbol()
Sets the unicode scientific symbol notation used for the unit.
public
setScientificSymbol(string $scientificSymbol) : UnitInterface
Parameters
- $scientificSymbol : string
-
The unicode character to be set as the units scientific symbol
Return values
UnitInterface —setSymbol()
Sets the symbol notation used for the unit.
public
setSymbol(string $symbol) : UnitInterface
Parameters
- $symbol : string
-
The value to be set as the units symbol
Return values
UnitInterface —setUnitOf()
Sets the type of measurement that this unit is measuring.
public
setUnitOf(string $unitOf) : UnitInterface
Parameters
- $unitOf : string
-
The value to be set as the units governing unit
Return values
UnitInterface —setUnits()
Sets the amount of base units required to make up 1 of the unit.
public
setUnits(float $units) : UnitInterface
Parameters
- $units : float
-
The amount of units required to make a single base unit
Return values
UnitInterface —setValue()
Sets the unit's numeric value (how many of it are there?).
public
setValue(int|float|string $value) : UnitInterface
Parameters
- $value : int|float|string
-
The numeric value to use.