| 
<?php
 /**
 *@package extendObj
 *@author Tianfan<[email protected]>
 *@license Apache License 2.0
 *@varsion 0.0.2
 *@description this package is a part of hawkphp  framework  v2(haven't released)
 */
 
 namespace hawkphp;
 
 class floatObj {
 
 private $_float;
 
 const CEIL = 0;
 const FLOOR = 1;
 const ROUND = 2;
 
 function __construct(float $float) {
 $this->_float = $float;
 }
 
 public function getInt($type = SELF::FLOOR): int {
 switch ($type) {
 case SELF::FLOOR: {
 $return = \floor($this->_float);
 break;
 }
 case SELF::CEIL: {
 $return = \ceil($this->_float);
 break;
 }
 case SELF::ROUND: {
 $return = \round($this->_float);
 break;
 }
 }
 return $return;
 }
 
 public function getDecimal(): int {
 $tmp = \strval($this->_float);
 $decimal = \explode(".", $tmp);
 return isset($decimal[1]) ? intval($decimal[1]) : 0;
 }
 
 public function toFloat(): float {
 return $this->_float;
 }
 
 public function __toString() {
 return strval($this->_float);
 }
 
 }
 
 |