public static function fromValue($value) {
    if (is_array($value)) {
      $elements = [];
      foreach ($value as $k => $v) {
        $elements[] = ArrayPairNode::create(static::fromValue($k), static::fromValue($v));
      }
      return ArrayNode::create($elements);
    }
    elseif (is_string($value)) {
      return StringNode::create(var_export($value, TRUE));
    }
    elseif (is_integer($value)) {
      return new IntegerNode(T_LNUMBER, $value);
    }
    elseif (is_float($value)) {
      return new FloatNode(T_DNUMBER, $value);
    }
    elseif (is_bool($value)) {
      return BooleanNode::create($value);
    }
    elseif (is_null($value)) {
      return NullNode::create('NULL');
    }
    else {
      throw new \InvalidArgumentException();
    }
  }
public static function fromValue($value) {
    if (is_array($value)) {
      $elements = [];
      foreach ($value as $k => $v) {
        $elements[] = ArrayPairNode::create(static::fromValue($k), static::fromValue($v));
      }
      return ArrayNode::create($elements);
    }
    elseif (is_string($value)) {
      return StringNode::create(var_export($value, TRUE));
    }
    elseif (is_integer($value)) {
      return new IntegerNode(T_LNUMBER, $value);
    }
    elseif (is_float($value)) {
      return new FloatNode(T_DNUMBER, $value);
    }
    elseif (is_bool($value)) {
      return BooleanNode::create($value);
    }
    elseif (is_null($value)) {
      return NullNode::create('NULL');
    }
    else {
      throw new \InvalidArgumentException();
    }
  }
public static function fromValue ( $ value ) { if ( is_array ( $ value ) ) { $ elements = [ ] ; foreach ( $ value as $ k => $ v ) { $ elements [ ] = ArrayPairNode :: create ( static :: fromValue ( $ k ) , static :: fromValue ( $ v ) ) ; } return ArrayNode :: create ( $ elements ) ; } elseif ( is_string ( $ value ) ) { return StringNode :: create ( var_export ( $ value , TRUE ) ) ; } elseif ( is_integer ( $ value ) ) { return new IntegerNode ( T_LNUMBER , $ value ) ; } elseif ( is_float ( $ value ) ) { return new FloatNode ( T_DNUMBER , $ value ) ; } elseif ( is_bool ( $ value ) ) { return BooleanNode :: create ( $ value ) ; } elseif ( is_null ( $ value ) ) { return NullNode :: create ( 'NULL' ) ; } else { throw new \ InvalidArgumentException ( ) ; } }
Creates a Node from a php value.

@param string|integer|float|boolean|array|null $value
The value to create a node for.

@return FloatNode|IntegerNode|StringNode|BooleanNode|NullNode|ArrayNode

@throws \InvalidArgumentException if $value is not a scalar.
Creates a Node from a php value .