public static function countMaxDepth(array $array)
    {
        $maxDepth = 1;
        foreach ($array as $element) {
            $depth = 1;
            if (is_array($element)) {
                $depth += self::countMaxDepth($element);
            }
            if ($depth > $maxDepth) $maxDepth = $depth;
        }

        return $maxDepth;
    }