Dumps a scalar value.

@param mixed $var
@param int $maxValueLen
@return string
324948
public static function dumpScalar($var, $maxValueLen)
    {
        switch (true) {
            case is_null($var):
                $val = 'null';
                break;
            case is_bool($var):
                $val = ($var ? 'true' : 'false');
                break;
            case is_integer($var):
                $val = sprintf('%d', $var);
                break;
            case is_float($var):
                $val = sprintf('%F', $var);
                break;
            case is_string($var):
                $val = self::formatString($var, $maxValueLen);
                break;
            case is_resource($var):
                $val = 'resource (' . get_resource_type($var) . ')';
                break;
            default:
                $val = gettype($var) . ' (unknown scalar type)';
                break;
        }
        return $val;
    }
200611
public function rule_max( $key, $value, $max )
	{
		return $this->rule_max_num( $key, strlen( $value ), $max );
	}
268502
public function setMax($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\Value::class);
        $this->max = $var;

        return $this;
    }
861487
public function toUpperCaseLast($var)
    {
        $v = '' . $var;
        $len = $this->strlen($var);
        if (!$len) {
            return '';
        }
        if (static::$nativeSupport['mbstring']) {
            if ($len > 1) {
                return mb_substr($v, 0, $len - 2) . mb_strtoupper(mb_substr($v, $len - 2));
            }
            return mb_strtoupper($v);
        }
        return $v;
    }
977556
public static function string($val, $minLen = 0, $maxLen = null): bool
    {
        if (!\is_string($val)) {
            return false;
        }

        // only type check.
        if ($minLen === 0 && $maxLen === null) {
            return true;
        }

        return self::integer(Helper::strlen($val), $minLen, $maxLen);
    }
422172
public static function dump($var, $continue = false, $hide = false, $return = false)
    {
        return self::it($var, AbstractDumper::VAR_DUMP, $continue, $hide, $return);
    }
1072435
public static function dump($var, $echo = true)
    {
        ob_start();
        var_dump($var);

        $output = ob_get_clean();
        $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);

        if (PHP_SAPI == "cli") {
            $output = PHP_EOL . PHP_EOL . $output . PHP_EOL;
        } else {
            $output = "<pre>" . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        }

        if ($echo) echo($output);

        return $output;
    }
1265764
public static function dump($var, $maxdepth = 10, $maxValueLen = 255, $stack = [])
    {
        $children = $hierarchyNotation = null;

        if (is_object($var)) {
            $children = get_object_vars($var);
            $hierarchyNotation = '->%s';
        } elseif (is_array($var)) {
            $children = $var;
            $hierarchyNotation = '[%s]';
        }


        if (isset($children)) {
            $ret = self::formatDumpStack($stack, $var);

            if ($maxdepth >= 0 && count($stack) == $maxdepth) {
                $ret .= ' (...)' . "\n";
            } else {
                if (count($children) == 0) {
                    $ret .= "(empty)\n";
                } else {
                    $ret .= "\n";

                    $i = 0;
                    foreach ($children as $name => $value) {
                        array_push($stack, sprintf($hierarchyNotation, $name));
                        $ret .= self::dump($value, $maxdepth, $maxValueLen, $stack);
                        array_pop($stack);
                        $i++;
                    }
                }
            }
        } else {
            $val = self::dumpScalar($var, $maxValueLen);
            if ($stack) {
                $ret = join('', $stack) . ' = ' . $val;
            } else {
                $ret = $val;
            }
            $ret .= "\n";
        }
        return $ret;
    }
11100
public static function var_dump($var, $return = false, $expandLevel = 1)
    {
        self::$hasArray = false;
        $toggScript = 'var colToggle = function(toggID) {var img = document.getElementById(toggID);if (document.getElementById(toggID + "-collapsable").style.display == "none") {document.getElementById(toggID + "-collapsable").style.display = "inline";setImg(toggID, 0);var previousSibling = document.getElementById(toggID + "-collapsable").previousSibling;while (previousSibling != null && (previousSibling.nodeType != 1 || previousSibling.tagName.toLowerCase() != "br")) {previousSibling = previousSibling.previousSibling;}} else {document.getElementById(toggID + "-collapsable").style.display = "none";setImg(toggID, 1);var previousSibling = document.getElementById(toggID + "-collapsable").previousSibling; while (previousSibling != null && (previousSibling.nodeType != 1 || previousSibling.tagName.toLowerCase() != "br")) {previousSibling = previousSibling.previousSibling;}}};';
        $imgScript = 'var setImg = function(objID,imgID,addStyle) {var imgStore = ["data:image/png;base64,' . self::$icon_collapse . '", "data:image/png;base64,' . self::$icon_expand . '"];if (objID) {document.getElementById(objID).setAttribute("src", imgStore[imgID]);if (addStyle){document.getElementById(objID).setAttribute("style", "position:relative;left:-5px;top:-1px;cursor:pointer;");}}};';
        $jsCode = preg_replace('/ +/', ' ', '<script>' . $toggScript . $imgScript . '</script>');
        $html = '<pre style="margin-bottom: 18px;' .
            'background: #f7f7f9;' .
            'border: 1px solid #e1e1e8;' .
            'padding: 8px;' .
            'border-radius: 4px;' .
            '-moz-border-radius: 4px;' .
            '-webkit-border radius: 4px;' .
            'display: block;' .
            'font-size: 12.05px;' .
            'white-space: pre-wrap;' .
            'word-wrap: break-word;' .
            'color: #333;' .
            'font-family: Menlo,Monaco,Consolas,\'Courier New\',monospace;">';
        $done  = array();
        $html .= self::recursiveVarDumpHelper($var, intval($expandLevel), 0, $done);
        $html .= '</pre>';

        if (self::$hasArray) {
            $html = $jsCode . $html;
        }

        if (!$return) {
            echo $html;
        }

        return $html;
    }
147343
protected function encode($var)
    {
        return (string) YamlParser::dump($var, $this->setting('inline', 5), $this->setting('indent', 2), true, false);
    }
893251
public function dump($value)
    {
        if (is_object($value)) {
            return get_class($value);
        }
        if (is_resource($value)) {
            return get_resource_type($value);
        }
        return var_export($value, true);
    }
308314
protected function map($value, $vMin, $vMax, $dMin, $dMax)
    {
        $vValue = floatval($value);
        $vRange = $vMax - $vMin;
        $dRange = $dMax - $dMin;
        return ($vValue - $vMin) * $dRange / $vRange + $dMin;
    }
45735
public function dump($value)
    {
        $dumper = $this->getDumper();

        if ($dumper) {
            // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
            // exclude verbose information (e.g. exception stack traces)
            if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) {
                $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);
                // Symfony VarDumper 2.6 Caster class dont exist.
            } else {
                $cloneVar = $this->getCloner()->cloneVar($value);
            }

            $dumper->dump(
                $cloneVar,
                $this->htmlDumperOutput
            );

            $output = $this->htmlDumperOutput->getOutput();
            $this->htmlDumperOutput->clear();

            return $output;
        }

        return htmlspecialchars(print_r($value, true));
    }
767680
public function real_grade_value($value, $max) {
        $localized = true;
        if (is_null($value) or $value === '') {
            return null;
        } elseif ($max == 0) {
            return 0;
        } else {
            return format_float($max * $value / 100, $this->gradedecimals, $localized);
        }
    }
67784
public static function dump($var, bool $return = false)
    {
        if ($return) {
            \ob_start();
            Dumper::dump($var, [
                Dumper::DEPTH => self::$maxDepth,
                Dumper::TRUNCATE => self::$maxLength,
            ]);

            return \ob_get_clean();
        }

        if (!self::isProductionMode()) {
            Dumper::dump($var, [
                Dumper::DEPTH => self::$maxDepth,
                Dumper::TRUNCATE => self::$maxLength,
                Dumper::LOCATION => self::$showLocation,
            ]);
        }

        return $var;
    }
1038850
public function toUpperCaseFirst($var)
    {
        $v = '' . $var;
        $len = $this->strlen($var);
        if (!$len) {
            return '';
        }
        if (static::$nativeSupport['mbstring']) {
            if ($len > 1) {
                return mb_strtoupper(mb_substr($v, 0, 1)) . mb_substr($v, 1);
            }
            return mb_strtoupper($v);
        }
        return $v;
    }
1189120
public static function lengthChar($val, $min, $max = null)
    {
        $len = mb_strlen($val, 'utf8');
        $result = ($len >= $min);
        if($max !== null)
        {
            $result = ($result && $len <= $max);
        }
        return $result;
    }