public static function isDenseArray($array)
    {
        $arrayLength = count($array);
        if(!$arrayLength) {
            return true;
        }

        // generate a dense array with incrementing numeric keys
        $keyTest = array_flip(range(0, $arrayLength - 1));

        // perform a diff on the two arrays' keys - if there are any differences,
        // then this array is not dense.
        $diff = array_diff_key($keyTest, $array);
        return empty($diff);
    }