public function getDependenciesFor(
        string $name,
        int $useStoredDependencies = self::USE_STORED_DEPENDENCIES
    ): array {
        $name = $this->getDefinitiveName($name);

        try {
            $reflection = new ReflectionClass($name);
        } catch (Throwable $e) {
            throw new ContainerException(sprintf(
                'Could not create instance for class `%s`.',
                $name
            ));
        }

        $constructor = $reflection->getConstructor();

        if (!$constructor) {
            return [];
        }

        $parameters = $constructor->getParameters();

        $relationships = [];
        $dependencies = [];
        foreach ($parameters as $parameter) {
            $class = $parameter->getClass();

            if ($class === null) {
                if (!$parameter->isOptional()) {
                    throw new ContainerException(sprintf(
                        'Cannot inject value for non-optional constructor parameter `$%s` without a default value.',
                        $parameter->name
                    ));
                }

                $dependencies[] = $parameter->getDefaultValue();

                continue;
            }

            $dependencyName = $this->getDefinitiveName($class->name);

            $this->storeRelationship($name, $dependencyName);

            $relationships[] = $dependencyName;

            if ($useStoredDependencies === self::USE_NEW_DEPENDENCIES) {
                $dependencies[] = $this->build($dependencyName);
            } elseif ($useStoredDependencies === self::USE_STORED_DEPENDENCIES) {
                $dependencies[] = $this->get($dependencyName);
            } else {
                throw new ContainerException(sprintf(
                    'Invalid dependency type value passed: `%d`.',
                    $useStoredDependencies
                ));
            }
        }

        return $dependencies;
    }