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 TypedData::getValue

File

src/Config/Schema/Number.php, line 39

Class

Number
A config schema type used to represent a Sass number.

Namespace

Drupal\compiler_scss\Config\Schema

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;
}