public function getSortedNames()
    {
        $sorted = [];
        $toSort = $this->getDependencies();

        while (count($toSort) > 0) {
            foreach ($toSort as $name => $dependencies) {
                if (!array_diff($dependencies, $sorted)) {
                    $sorted[] = $name;
                    unset($toSort[$name]);
                }
            }
        }

        return $sorted;
    }