protected static function exportObject($var, $depth = 1, $indent = 0)
    {
        $out = '';
        $props = [];
        $className = get_class($var);
        $out .= 'object(' . $className . ') {';
        $break = "\n" . str_repeat("\t", $indent);
        $end = "\n" . str_repeat("\t", $indent - 1);
        if ($depth > 0 && method_exists($var, '__debugInfo')) {
            try {
                return $out . "\n" .
                    substr(static::exportArray($var->__debugInfo(), $depth - 1, $indent), 1, -1) .
                    $end . '}';
            } catch (Exception $e) {
                $message = $e->getMessage();
                return $out . "\n(unable to export object: $message)\n }";
            }
        }
        if ($depth > 0) {
            $objectVars = get_object_vars($var);
            foreach ($objectVars as $key => $value) {
                $value = static::export($value, $depth - 1, $indent);
                $props[] = "$key => " . $value;
            }
            $ref = new ReflectionObject($var);
            $filters = [
                ReflectionProperty::IS_PROTECTED => 'protected',
                ReflectionProperty::IS_PRIVATE => 'private',
            ];
            foreach ($filters as $filter => $visibility) {
                $reflectionProperties = $ref->getProperties($filter);
                foreach ($reflectionProperties as $reflectionProperty) {
                    $reflectionProperty->setAccessible(true);
                    $property = $reflectionProperty->getValue($var);
                    $value = static::export($property, $depth - 1, $indent);
                    $key = $reflectionProperty->name;
                    $props[] = sprintf('[%s] %s => %s', $visibility, $key, $value);
                }
            }
            $out .= $break . implode($break, $props) . $end;
        }
        $out .= '}';
        return $out;
    }