private static function arrayDepth($array, $level = 0)
    {
        if (!$array) {
            return $level;
        }

        if (!is_array($array)) {
            return $level;
        }

        ++$level;
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $level = $level < self::arrayDepth($value, $level) ? self::arrayDepth($value, $level) : $level;
            }
        }

        return $level;
    }