You are here

public function Number::getValue in SCSS Compiler 1.0.x

Same name in this branch
  1. 1.0.x src/Config/Schema/Number.php \Drupal\compiler_scss\Config\Schema\Number::getValue()
  2. 1.0.x src/Plugin/DataType/Number.php \Drupal\compiler_scss\Plugin\DataType\Number::getValue()

Gets the data value.

Return value

mixed The data value.

Overrides Map::getValue

File

src/Plugin/DataType/Number.php, line 30

Class

Number
A data type used to represent a Sass number.

Namespace

Drupal\compiler_scss\Plugin\DataType

Code

public function getValue() {
  $value = $this
    ->toArray() + [
    'value' => NULL,
    'unit' => NULL,
  ];
  if (is_numeric($value['value'])) {
    if (is_string($value['unit']) && strlen($value['unit']) > 0) {
      return new IntermediateNumber($value['value'], $value['unit']);
    }
    return floatval($value['value']);
  }
  return NULL;
}