SassNumber::__construct PHP Method

__construct() public method

Sets the value and units of the number.
public __construct ( $value ) : SassNumber
return SassNumber
    public function __construct($value)
    {
        preg_match(self::MATCH, $value, $matches);
        $matches += array(null, null, '', '');
        $this->value = $matches[self::VALUE];
        if (!empty($matches[self::UNITS])) {
            $units = explode('/', $matches[self::UNITS]);
            $numeratorUnits = $denominatorUnits = array();
            foreach (explode('*', $units[0]) as $unit) {
                $numeratorUnits[] = trim($unit);
            }
            if (isset($units[1])) {
                foreach (explode('*', $units[1]) as $unit) {
                    $denominatorUnits[] = trim($unit);
                }
            }
            $units = $this->removeCommonUnits($numeratorUnits, $denominatorUnits);
            $this->numeratorUnits = $units[0];
            $this->denominatorUnits = $units[1];
        }
    }