public function instantiate(string $class, array $parameters = [])
    {
        $class = new \ReflectionClass($class);
        $instance = $class->newInstanceWithoutConstructor();

        $this->inject($instance);

        $constructor = $class->getConstructor();

        if ($constructor) {
            $parameters = $this->getFunctionParameters($constructor, $parameters);
            $constructor->setAccessible(true);
            $constructor->invokeArgs($instance, $parameters);
        }

        return $instance;
    }