private function doResolve(array &$dependencies, array &$ordered, array $available): bool
    {
        $failed = true;

        foreach ($dependencies as $name => $requires) {
            if (true === $this->canBeResolved($requires, $available, $ordered)) {
                $failed = false;
                $ordered[] = $name;

                unset($dependencies[$name]);
            }
        }

        return !$failed;
    }