src/PhpPackages/Dumpy/Dumpy.php
public function dump($value)
    {
        switch (gettype($value)) {
            // Handle boolean values.
            case "boolean": {
                $output = $value ? "true" : "false";

                // You can represent booleans (and NULLs) in either lower- or uppercase format.
                return $this->config["bool_lowercase"] ? $output : strtoupper($output);
            }

            // Handle NULL values.
            case "NULL": {
                return $this->config["null_lowercase"] ? "null" : "NULL";
            }

            // Handle integers.
            case "integer": {
                return (string) $value;
            }

            // Handle floats (doubles).
            case "double": {
                // Dumpy allows you to round floats to round_double decimal points.
                if ($this->config["round_double"] !== false) {
                    $value = round($value, $this->config["round_double"], PHP_ROUND_HALF_UP);
                }

                return (string) $value;
            }

            // Handle strings.
            case "string": {
                // @suggestion Multibyte support?
                // Look above for the detailed explanation.
                if (strlen($value) > $this->config["str_max_length"]) {
                    $value = substr($value, 0, $this->config["str_max_length"]) . "...";
                }

                // Dumpy allows you to replace newline characters with "\\n".
                if ($this->config["replace_newline"]) {
                    $value = str_replace(PHP_EOL, "\\n", $value);
                }

                return "\"{$value}\"";
            }

            // Handle arrays.
            case "array": {
                return $this->printArray($value) . PHP_EOL;
            }

            // Handle objects.
            case "object": {
                return $this->printObject($value);
            }
            // @codeCoverageIgnoreStart
        }
    }
public function dump($value)
    {
        switch (gettype($value)) {
            // Handle boolean values.
            case "boolean": {
                $output = $value ? "true" : "false";

                // You can represent booleans (and NULLs) in either lower- or uppercase format.
                return $this->config["bool_lowercase"] ? $output : strtoupper($output);
            }

            // Handle NULL values.
            case "NULL": {
                return $this->config["null_lowercase"] ? "null" : "NULL";
            }

            // Handle integers.
            case "integer": {
                return (string) $value;
            }

            // Handle floats (doubles).
            case "double": {
                // Dumpy allows you to round floats to round_double decimal points.
                if ($this->config["round_double"] !== false) {
                    $value = round($value, $this->config["round_double"], PHP_ROUND_HALF_UP);
                }

                return (string) $value;
            }

            // Handle strings.
            case "string": {
                // @suggestion Multibyte support?
                // Look above for the detailed explanation.
                if (strlen($value) > $this->config["str_max_length"]) {
                    $value = substr($value, 0, $this->config["str_max_length"]) . "...";
                }

                // Dumpy allows you to replace newline characters with "\\n".
                if ($this->config["replace_newline"]) {
                    $value = str_replace(PHP_EOL, "\\n", $value);
                }

                return "\"{$value}\"";
            }

            // Handle arrays.
            case "array": {
                return $this->printArray($value) . PHP_EOL;
            }

            // Handle objects.
            case "object": {
                return $this->printObject($value);
            }
            // @codeCoverageIgnoreStart
        }
    }
public function dump ( $ value ) { switch ( gettype ( $ value ) ) { // Handle boolean values. case "boolean" : { $ output = $ value ? "true" : "false" ; // You can represent booleans (and NULLs) in either lower- or uppercase format. return $ this -> config [ "bool_lowercase" ] ? $ output : strtoupper ( $ output ) ; } // Handle NULL values. case "NULL" : { return $ this -> config [ "null_lowercase" ] ? "null" : "NULL" ; } // Handle integers. case "integer" : { return ( string ) $ value ; } // Handle floats (doubles). case "double" : { // Dumpy allows you to round floats to round_double decimal points. if ( $ this -> config [ "round_double" ] !== false ) { $ value = round ( $ value , $ this -> config [ "round_double" ] , PHP_ROUND_HALF_UP ) ; } return ( string ) $ value ; } // Handle strings. case "string" : { // @suggestion Multibyte support? // Look above for the detailed explanation. if ( strlen ( $ value ) > $ this -> config [ "str_max_length" ] ) { $ value = substr ( $ value , 0 , $ this -> config [ "str_max_length" ] ) . "..." ; } // Dumpy allows you to replace newline characters with "\\n". if ( $ this -> config [ "replace_newline" ] ) { $ value = str_replace ( PHP_EOL , "\\n" , $ value ) ; } return "\"{$value}\"" ; } // Handle arrays. case "array" : { return $ this -> printArray ( $ value ) . PHP_EOL ; } // Handle objects. case "object" : { return $ this -> printObject ( $ value ) ; } // @codeCoverageIgnoreStart } }
This method helps you get string representations of various PHP data types.

@param mixed $value
@return string
This method helps you get string representations of various PHP data types .