private function getUniqueImports(array $imports): array
    {
        uksort($imports, function ($a, $b) use ($imports) {
            $alias_a = is_numeric($a) ? " as $a;" : '';
            $alias_b = is_numeric($b) ? " as $b;" : '';

            return strcmp($imports[$a] . $alias_a, $imports[$b] . $alias_b);
        });

        $unique_imports = [];
        $next           = null;
        do {
            $key   = key($imports);
            $value = current($imports);
            $next  = next($imports);

            if ($value === $next && $key === key($imports)) {
                continue;
            }

            if ($key) {
                $unique_imports[$key] = $value;
                continue;
            }

            $unique_imports[] = $value;
        } while ($next !== false);

        return $unique_imports;
    }