PHP Class Leafo\ScssPhp\Node\Number

{@internal This is a work-in-progress. The \ArrayAccess interface is temporary until the migration is complete.}}
Author: Anthon Pang ([email protected])
Inheritance: extends Leafo\ScssPhp\Node, implements ArrayAccess
Datei anzeigen Open project: leafo/scssphp Class Usage Examples

Public Properties

Property Type Description
$dimension integer | float
$precision integer
$units array

Protected Properties

Property Type Description
$unitTable array

Public Methods

Method Description
__construct ( mixed $dimension, mixed $initialUnit ) Initialize number
__toString ( )
coerce ( array $units ) : Number Coerce number to target units
normalize ( ) : Number Normalize number
offsetExists ( $offset )
offsetGet ( $offset )
offsetSet ( $offset, $value )
offsetUnset ( $offset )
output ( Compiler $compiler = null ) : string Output number
unitStr ( ) : string Returns unit(s) as the product of numerator units divided by the product of denominator units
unitless ( ) : boolean Returns true if the number is unitless

Private Methods

Method Description
normalizeUnits ( integer | float &$dimension, array &$units, string $baseUnit = 'in' ) Normalize units

Method Details

__construct() public method

Initialize number
public __construct ( mixed $dimension, mixed $initialUnit )
$dimension mixed
$initialUnit mixed

__toString() public method

public __toString ( )

coerce() public method

Coerce number to target units
public coerce ( array $units ) : Number
$units array
return Number

normalize() public method

Normalize number
public normalize ( ) : Number
return Number

offsetExists() public method

public offsetExists ( $offset )

offsetGet() public method

public offsetGet ( $offset )

offsetSet() public method

public offsetSet ( $offset, $value )

offsetUnset() public method

public offsetUnset ( $offset )

output() public method

Output number
public output ( Compiler $compiler = null ) : string
$compiler Leafo\ScssPhp\Compiler
return string

unitStr() public method

Returns unit(s) as the product of numerator units divided by the product of denominator units
public unitStr ( ) : string
return string

unitless() public method

Returns true if the number is unitless
public unitless ( ) : boolean
return boolean

Property Details

$dimension public_oe property

public int|float $dimension
return integer | float

$precision public_oe static_oe property

public static int $precision
return integer

$unitTable protected_oe static_oe property

See also: http://www.w3.org/TR/2012/WD-css3-values-20120308/
protected static array $unitTable
return array

$units public_oe property

public array $units
return array