Index

UnitVector

MMO\math\helpers · 1 symbol · generated 30 Sep 2026

class

UnitVector

UnitVector.php:14

Represent a unit with its power and its factor: {factor} * ({unit}^{power})

class MMO\math\helpers\UnitVector implements Stringable, MMO\math\interfaces\iWithUnits
Namespace
MMO\math\helpers
Implements
Stringable, iWithUnits

Index

factor
power
unit
divideBy($factor)
getFactor()
hasUnits()Usefull for polynome to determine if variable (number) has units
isConstant()
isCustom()
isPrimitive()
isSameUnits($unit, $checkPower)
isTime()
multiplyBy($factor)
name()
numberValue()Get the value of this vector.
powerBy($power)
toNumber()
toPrimitives()
unitFactor($unit)
units()Transform this vector into Units Warning: for polynome units, the number's units ius returned
__construct($unit, $power, $factor)
__toString()

Properties3

factor

float $factor
Type
float

power

float $power
Type
float

unit

MMO\math\interfaces\iUnit|string $unit
Type
iUnit | string

Methods18

hasUnits()

UnitVector.php:36

Usefull for polynome to determine if variable (number) has units

function hasUnits(): bool
returnsbool

isSameUnits($unit, $checkPower)

UnitVector.php:118
function isSameUnits( MMO\math\interfaces\iUnit|MMO\math\helpers\Units|self|string $unit, bool $checkPower = true ): bool
$unitiUnit | Units | self | string
$checkPower = truebool
returnsbool

numberValue()

UnitVector.php:72

Get the value of this vector.

function numberValue(): int|float|nullUsed by polynome when the unit is a UnitNumber
returnsint | float | null

units()

UnitVector.php:45

Transform this vector into Units Warning: for polynome units, the number's units ius returned

function units(): ?MMO\math\helpers\Units
returnsnull | Units

__construct($unit, $power, $factor)

UnitVector.php:20
function __construct( MMO\math\interfaces\iUnit|string $unit, float $power = 1.0, MMO\math\enums\cPrefix|float $factor = 1.0 )
$unitiUnit | string
$power = 1.0float
$factor = 1.0cPrefix | float