protected function arrayToKey(array $array)
    {
        if ($this->isSequential($array)) {
            return $this->sequentialArrayToKey($array);
        }

        $parts = [];

        $keys = array_keys($array);
        sort($keys);

        foreach ($keys as $key) {
            $parts[] = $key;
            $parts[] = $this->castArrayValue($array[$key]);
        }

        return implode('_', $parts);
    }