clean

@param string|int|float $num

@return  mixed
779426
public function clean($num)
    {
        $num = (float) $num;

        if ($this->min !== null && $num < $this->min) {
            $num = (float) $this->min;
        }

        if ($this->max !== null && $num > $this->max) {
            $num = (float) $this->max;
        }

        if ($this->forceInt) {
            $num = (int) $num;
        }

        return $num;
    }
575611
public function clean($value)
  {
    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    $tmp = PruneWhitespaceCleaner::get()->clean($value);
    if ($tmp==='' || $tmp===null)
    {
      return null;
    }

    return mb_substr($tmp, 0, $this->maxLength);
  }
724139
private function getRand($num = 6){
		$string = '';
		$source = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_';
		$length = strlen($source);
		while(strlen($string) < $num){
			$string .= substr($source,rand(0,1000)%$length,1);
		}
		return $string;
	}
781727
protected function readIntegerList($num)
    {
        if ($this->littleEndian) {
            return unpack('V' . $num, fread($this->file, 4 * $num));
        }

        return unpack('N' . $num, fread($this->file, 4 * $num));
    }
288461
public function batchSize($num)
    {
        $num = (integer) $num;
        $this->batchSize = $num;
        $this->riakCursor->batchSize($num);
        return $this;
    }
1279328
public function clean($value)
  {
    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    $tmp = AmbiguityCleaner::get()->clean($value);

    $tmp = str_replace([' ', "\t", "\n"], '', $tmp);
    if ($tmp==='') $tmp = null;

    return $tmp;
  }
340812
public static function toRoman(int $num) : string
    {
        $result = '';
        foreach (self::$romans as $roman => $value) {
            $matches = intval($num / $value);
            $result .= str_repeat($roman, $matches);
            $num     = $num % $value;
        }
        return $result;
    }
818884
public static function clean($input)
    {
        // handle input of type array
        if (is_array($input)) {
            foreach ($input as $idx => $val) {
                $input[$idx] = self::clean($val);
            }
            return $input;
        }

        if (!is_string($input) || $input == '') {
            return $input;
        }

        // iconv/mbstring are much faster (especially with long strings)
        if (function_exists('mb_convert_encoding')) {
            $msch = mb_substitute_character();
            mb_substitute_character('none');
            $res = mb_convert_encoding($input, 'UTF-8', 'UTF-8');
            mb_substitute_character($msch);

            if ($res !== false) {
                return $res;
            }
        }

        if (function_exists('iconv')) {
            if (($res = @iconv('UTF-8', 'UTF-8//IGNORE', $input)) !== false) {
                return $res;
            }
        }

        $seq    = '';
        $out    = '';
        $regexp = '/^('.
//          '[\x00-\x7F]'.                                  // UTF8-1
            '|[\xC2-\xDF][\x80-\xBF]'.                      // UTF8-2
            '|\xE0[\xA0-\xBF][\x80-\xBF]'.                  // UTF8-3
            '|[\xE1-\xEC][\x80-\xBF][\x80-\xBF]'.           // UTF8-3
            '|\xED[\x80-\x9F][\x80-\xBF]'.                  // UTF8-3
            '|[\xEE-\xEF][\x80-\xBF][\x80-\xBF]'.           // UTF8-3
            '|\xF0[\x90-\xBF][\x80-\xBF][\x80-\xBF]'.       // UTF8-4
            '|[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF]'.// UTF8-4
            '|\xF4[\x80-\x8F][\x80-\xBF][\x80-\xBF]'.       // UTF8-4
            ')$/';

        for ($i = 0, $len = strlen($input); $i < $len; $i++) {
            $chr = $input[$i];
            $ord = ord($chr);

            // 1-byte character
            if ($ord <= 0x7F) {
                if ($seq !== '') {
                    $out .= preg_match($regexp, $seq) ? $seq : '';
                    $seq = '';
                }

                $out .= $chr;
            }
            // first byte of multibyte sequence
            else if ($ord >= 0xC0) {
                if ($seq !== '') {
                    $out .= preg_match($regexp, $seq) ? $seq : '';
                    $seq = '';
                }

                $seq = $chr;
            }
            // next byte of multibyte sequence
            else if ($seq !== '') {
                $seq .= $chr;
            }
        }

        if ($seq !== '') {
            $out .= preg_match($regexp, $seq) ? $seq : '';
        }

        return $out;
    }
487643
public static function clean( $input, $noarray = false, $db_field = false ) {

		$output = trim( (string) $input );

		$output = str_replace( '--1', 'podsfixtemp1', $output );
		$output = str_replace( '__1', 'podsfixtemp2', $output );

		if ( false !== $noarray ) {
			$output = preg_replace( '/\[podsfixtemp\d+\]/', '-', $output );
			$output = preg_replace( '/\[\d*\]/', '-', $output );
		}

		$output = str_replace( array( '[', ']' ), '-', $output );

		$output = pods_clean_name( $output );

		$output = preg_replace( '/([^a-z0-9\-_])/', '', $output );
		$output = preg_replace( '/(_){2,}/', '_', $output );
		$output = preg_replace( '/(-){2,}/', '-', $output );

		if ( true !== $db_field ) {
			$output = str_replace( '_', '-', $output );
		}

		$output = rtrim( $output, '-' );

		$output = str_replace( 'podsfixtemp1', '--1', $output );
		$output = str_replace( 'podsfixtemp2', '__1', $output );

		return $output;
	}
274530
public function shorten($num) {
		$str = '';

		while ($num > 0) {
			$str = $this->alphabet[($num % $this->base)] . $str;
			$num = (int) ($num / $this->base);
		}

		return $str;
	}
255481
protected function toWords($num)
    {
        $ret = '';
        $num = strval($num);

        if ((int)$num === 0) {
            return self::$digits[0];
        }

        if (substr($num, 0, 1) == '-') {
            $ret = $this->minus . $this->wordSeparator;
            $num = substr($num, 1);
        }

        $num = preg_replace('/^0+/', '', $num);
        $num_length = strlen($num);

        if ($num_length % 3 !== 0) {
            $num = str_pad($num, $num_length + (3-($num_length%3)), '0', STR_PAD_LEFT);
        }

        $groups = str_split($num, 3);
        $g_index = count($groups) - 1;
        foreach ($groups as $i => $g) {

            if ((int)$g[0] > 1)
                $ret .= self::$digits[$g[0]] . $this->wordSeparator;

            if ((int)$g[0] > 0)
                $ret .= "yüz" . $this->wordSeparator;

            if ((int)$g[1] > 0)
                $ret .= self::$digits_second[$g[1]] . $this->wordSeparator;

            if ((int)$g[2] > 0 && (($num_length === 4 && $i === 0 && (int)$g[2] <= 1) === false))
                $ret .= self::$digits[$g[2]] . $this->wordSeparator;

            if ((int)$g > 0)
                $ret .= self::$exponent[$g_index] . $this->wordSeparator;

            $g_index--;
        }

        return $ret;
    }
141055
public function getCall($num)
    {
        if (array_key_exists($num, $this->calls)) {

            return $this->calls[$num];
        }

        return null;
    }
1036724
private function get_translation_string($num) {
        $length = $this->table_translations[$num * 2 + 1];
        $offset = $this->table_translations[$num * 2 + 2];
        if (!$length)
            return '';
        fseek($this->STREAM, $offset);
        $data = fread($this->STREAM, $length);
        return (string)$data;
    }
334475
private static function removeTrailingZeros($num)
    {
        // Only do this if number has a decimal value.
        if (strstr($num, '.')) {
            $num  = rtrim($num, '0');
            $last = substr($num, strlen($num) - 1, 1) == '.';
            $num  = $last ? substr($num, 0, strlen($num) - 1) : $num;

            return $num;
        } else {
            // No decimal value, don't modify number
            return $num;
        }
    }
743254
public static function word(int $num): string
    {
        $numberWordMap = [
            1 => Yii::t('yuncms', 'One'),
            2 => Yii::t('yuncms', 'Two'),
            3 => Yii::t('yuncms', 'Three'),
            4 => Yii::t('yuncms', 'Four'),
            5 => Yii::t('yuncms', 'Five'),
            6 => Yii::t('yuncms', 'Six'),
            7 => Yii::t('yuncms', 'Seven'),
            8 => Yii::t('yuncms', 'Eight'),
            9 => Yii::t('yuncms', 'Nine')
        ];

        if (isset($numberWordMap[$num])) {
            return $numberWordMap[$num];
        }

        return (string)$num;
    }
913125
public function clean($value)
  {
    // First prune whitespace.
    $cleaner = PruneWhitespaceCleaner::get();
    $value   = $cleaner->clean($value);

    if ($value==='' || $value===null || $value===false)
    {
      return null;
    }

    $tidyConfig = ['clean'          => false,
                   'output-xhtml'   => true,
                   'show-body-only' => true,
                   'wrap'           => 100];

    $tidy = new \tidy;

    $tidy->parseString($value, $tidyConfig, self::getTidyEncoding());
    $tidy->cleanRepair();
    $value = trim(tidy_get_output($tidy));

    // In some cases Tidy returns an empty paragraph only.
    if (preg_match('/^(([\ \r\n\t])|(<p>)|(<\/p>)|(&nbsp;))*$/', $value)==1)
    {
      $value = null;
    }

    return $value;
  }
314451
protected function cleanValue($value)
	{
		if (is_array($value)) {
			return array_map(function ($v) {
				return $this->cleanValue($v);
			}, $value);
		} else {
			return stripslashes($value);
		}
	}