public static function caseConvertArrayKeysRecursively(
        array $array,
        string $method = self::PASCALCASE,
        string $separator = '_'
    ): array {
        $return = [];
        foreach ($array as $key => $value) {
            if (!preg_match('/^\d+$/', $key)) {
                $key = self::$method(preg_replace('/\-/', '_', $key), true, $separator);
            }
            if (is_array($value)) {
                $value = self::caseConvertArrayKeysRecursively($value, $method);
            }
            $return[$key] = $value;
        }
        return $return;
    }
public static function caseConvertArrayKeysRecursively(
        array $array,
        string $method = self::PASCALCASE,
        string $separator = '_'
    ): array {
        $return = [];
        foreach ($array as $key => $value) {
            if (!preg_match('/^\d+$/', $key)) {
                $key = self::$method(preg_replace('/\-/', '_', $key), true, $separator);
            }
            if (is_array($value)) {
                $value = self::caseConvertArrayKeysRecursively($value, $method);
            }
            $return[$key] = $value;
        }
        return $return;
    }
public static function caseConvertArrayKeysRecursively ( array $ array , string $ method = self :: PASCALCASE , string $ separator = '_' ) : array { $ return = [ ] ; foreach ( $ array as $ key => $ value ) { if ( ! preg_match ( '/^\d+$/' , $ key ) ) { $ key = self :: $ method ( preg_replace ( '/\-/' , '_' , $ key ) , true , $ separator ) ; } if ( is_array ( $ value ) ) { $ value = self :: caseConvertArrayKeysRecursively ( $ value , $ method ) ; } $ return [ $ key ] = $ value ; } return $ return ; }
Convert key case Recursively, using the method defined.

@param string[] $array
@param string $method The Convention method to execute. Default pascal().
@param string $separator Default '_'.
@return mixed[]
Convert key case Recursively using the method defined .