File dsl/standard/Number.class.php

Last commit: Thu Dec 26 12:12:43 2024 +0100	Jan Dankert	The last update from upstream repository openrat-cms.
1 <?php 2 3 4 namespace dsl\standard; 5 6 7 use dsl\context\BaseScriptableObject; 8 9 class Number extends BaseScriptableObject 10 { 11 private $value; 12 13 public $MAX_SAFE_INTEGER = PHP_INT_MAX; 14 public $MIN_SAFE_INTEGER = PHP_INT_MIN; 15 16 /** 17 * Number constructor. 18 * @param $value 19 */ 20 public function __construct($value=null) 21 { 22 $this->value = $value; 23 } 24 25 public function __toString() 26 { 27 return "" . $this->value; 28 } 29 30 31 public function __invoke( $value ) 32 { 33 return new Number( $value ); 34 } 35 36 public function parseFloat( $num ) 37 { 38 return floatval($num ); 39 } 40 41 public function parseInt( $num ) 42 { 43 return intval($num); 44 } 45 46 public function toFixed( $digits ) 47 { 48 return number_format($this->value,$digits); 49 } 50 51 public function valueOf( $val ) 52 { 53 return new Number( $val ); 54 } 55 56 public function toNumber() { 57 return $this->value; 58 } 59 60 }
Download dsl/standard/Number.class.php
History Thu, 26 Dec 2024 12:12:43 +0100 Jan Dankert The last update from upstream repository openrat-cms.