Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NumericLiteral.php

function NumericLiteral::setValue

Sets node's value

Parameters

float $value Value:

Return value

$this

Overrides Literal::setValue

File

vendor/mck89/peast/lib/Peast/Syntax/Node/NumericLiteral.php, line 86

Class

NumericLiteral
A node that represents a numeric literal.

Namespace

Peast\Syntax\Node

Code

public function setValue($value) {
    $value = (double) $value;
    $intValue = (int) $value;
    if ($value == $intValue) {
        $value = $intValue;
    }
    $this->value = $value;
    
    //Force recalculation of the raw value
    return $this->setFormat($this->format);
}
RSS feed
Powered by Drupal