@param bool $asInt

@return float|int
437851
public function getDayOfSeason($asInt = true)
    {
        $value = fmod($this->getRyzomDay(), self::RYZOM_SEASON_IN_DAY) + 1;

        return $asInt ? (int) $value : $value;
    }
902670
protected function pack_int($int) {
        if (PHP_INT_SIZE === 8) {
            $left = 0xffffffff00000000;
            $right = 0x00000000ffffffff;
            $l = ($int & $left) >>32;
            $r = $int & $right;

            return pack('NN', $l, $r);
        } else {
            return pack('NN', 0, $int);
        }
    }
321841
public function getSoftProperties(Bool $asObject=false)
	{
		if ($asObject == true) {
			return (Object) $this->softProperties;
		}

		return $this->softProperties;
	}
448709
public function asIntType()
    {
        if ($this->isReal()) {
            /** @noinspection PhpUndefinedMethodInspection */
            return TypeFactory::create('int', floor($this->value['real']->get()));
        }
        
        throw new NotRealComplexException();
    }
144842
public function getDay($asInt = true)
    {
        $value = fmod($this->getRyzomDay(), self::RYZOM_WEEK_IN_DAY) + 1;

        return $asInt ? (int) $value : $value;
    }
1148960
public function byteIntToString($int)
    {
        if ($int % 1073741824 == 0) { // 1024 * 1024 * 1024
            return ($int / 1073741824).'G';
        } elseif ($int % 1048576 == 0) { // 1024 * 1024
            return ($int / 1048576).'M';
        } elseif ($int % 1024 == 0) {
            return ($int / 1024).'K';
        }

        return (string) $int;
    }
387996
protected function asc2int($asc): int
    {
        return (ord($asc[0]) << 24) | (ord($asc[1]) << 16) |
            (ord($asc[2]) << 8) | (ord($asc[3]));
    }
384664
private static function prepareFloat($number): float
	{
		if ($number === null) {
			return 0;
		} elseif (is_numeric($number)) {
			return (float) $number;
		} else {
			throw new InvalidArgumentException("Value must be a number");
		}
	}
1364629
public function getId($as_array = false, $default = false)
  {
    $f = function ($var) {
      return is_numeric($var) && $var > 0;
    };

    return $as_array ? $this->getParameterAsArray('id', $f, $default) : $this->getParameter('id', $f, $default);
  }
1099504
function safe_intval($x)
    {
        // PHP 5.3, per http://php.net/releases/5_3_0.php, introduced "more consistent float rounding"
        // PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster
        if (is_int($x) || version_compare(PHP_VERSION, '5.3.0') >= 0 || (PHP_OS & "\xDF\xDF\xDF") === 'WIN') {
            return $x;
        }
        return (fmod($x, 0x80000000) & 0x7FFFFFFF) |
            ((fmod(floor($x / 0x80000000), 2) & 1) << 31);
    }
427680
public function getIsDecimal( $number = false )
	{
		return	strpos( $number === false ? $this->_value : $number, "." ) !== false &&
				trim( substr( $number === false ? $this->_value : $number, strpos( $number === false ? $this->_value : $number, "." ) + 1 ), "0" );
	}
1036802
public static function isBool($input) {
        if(is_bool($input)) {
            return $input; //Already a boolean
        }
        if(is_int($input) || is_float($input)) {
            return $input != 0;
        }
        $input = strtolower(self::isString($input));
        return in_array($input, array('active', 'true', 'yes', '1', 'on', 'y'), TRUE);
    }
875985
public function writeInt($int) {

    			// Note that this is simply a sanity check of the conversion algorithm;
    			// when live this sanity check should be disabled (overflow check handled in this.writeAMFData).
    			/*if ( ( ( $int & 0x70000000 ) != 0 ) && ( ( $int & 0x80000000 ) == 0 ) )
    				throw new Exception ( 'Integer overflow during Int32 to AMF3 conversion' );*/

    			if ( ( $int & 0xffffff80 ) == 0 )
    			{
    				$this->stream->writeByte ( $int & 0x7f );

    				return;
    			}

    			if ( ( $int & 0xffffc000 ) == 0 )
    			{
    				$this->stream->writeByte ( ( $int >> 7 ) | 0x80 );
    				$this->stream->writeByte ( $int & 0x7f );

    				return;
    			}

    			if ( ( $int & 0xffe00000 ) == 0 )
    			{
    				$this->stream->writeByte ( ( $int >> 14 ) | 0x80 );
    				$this->stream->writeByte ( ( $int >> 7 ) | 0x80 );
    				$this->stream->writeByte ( $int & 0x7f );

    				return;
    			}

    			$this->stream->writeByte ( ( $int >> 22 ) | 0x80 );
    			$this->stream->writeByte ( ( $int >> 15 ) | 0x80 );
    			$this->stream->writeByte ( ( $int >> 8 ) | 0x80 );
    			$this->stream->writeByte ( $int & 0xff );

    			return;
        }
605701
public function getAsFloat($column, $default = false, $decimals = null, $point = null, $thousands = null)
  {
    if (is_null($decimals)) {
      $decimals = 2;
    }
    if (is_null($point)) {
      $point = '.';
    }
    if (is_null($thousands)) {
      $thousands = '';
    }
    $v = $this->get($column);

    return $v ? number_format($v, $decimals, $point, $thousands) : $default;
  }
1137459
public function sort($key, $asc = true)
	{
		return $this->sortByCallback(function($a, $b) use ($key, $asc)
		{
			if (!isset($a->$key) || !isset($b->$key))
			{
				if (!isset($a->$key))
				{
					return ($asc) ? -1 :  1;
				}

				if (!isset($b->$key))
				{
					return ($asc) ?  1 : -1;
				}

				return 0;
			}

			if ($asc)
			{
				return strnatcmp($a->$key, $b->$key);
			}
			else
			{
				return strnatcmp($b->$key, $a->$key);
			}
		});
	}
541165
public static function digits($value, $asInt = FALSE, $nullable = TRUE)
	{
		$value = preg_replace('/\D+/', '', (string) $value);
		if ($nullable && !strlen($value)) $value = NULL;

		return $asInt ? self::setTypeInt($value, $nullable) : $value;
	}
1084890
public function getMicrotime($get_as_float = false)
    {
        if ($get_as_float) {
            $converter = new MicrotimeConverter();
            return $converter->convertStringToFloat($this->timestamp);
        } else {
            return $this->timestamp;
        }
    }