static function dump(
        $value,
        int $maxLevel = self::DEFAULT_MAX_LEVEL,
        ?int $maxStringLen = self::DEFAULT_MAX_STRING_LENGTH,
        ?string $encoding = null,
        int $currentLevel = 1
    ): string {
        $type = gettype($value);

        switch ($type) {
            case 'array':
                return self::dumpArray($value, $maxLevel, $maxStringLen, $encoding, $currentLevel);

            case 'object':
                return self::dumpObject($value, $maxLevel, $maxStringLen, $encoding, $currentLevel);

            case 'string':
                return static::dumpString($value, $maxStringLen, $encoding, ['"', '"'], '...');

            case 'integer':
                return (string) $value;

            case 'double':
                return -INF === $value ? '-INF' : sprintf('%F', $value);

            case 'boolean':
                return $value ? 'true' : 'false';

            case 'resource':
                return 'resource(' . get_resource_type($value) . '#' . ((int) $value) . ')';

            default:
                return $type;
        }
    }