protected function getProviderCreator($provider)
    {
        if (is_string($provider)) {
            return function($injector, $name, $key) use($provider)
                   {
                       $providerInstance = $injector->getInstance($provider);
                       if (!($providerInstance instanceof InjectionProvider)) {
                           throw new BindingException('Configured provider class ' . $provider . ' for ' . $name . '[' . $key . '] is not an instance of stubbles\ioc\InjectionProvider.');
                       }

                       return $providerInstance->get();

                   };
        } elseif ($provider instanceof InjectionProvider) {
            return function() use($provider) { return $provider->get(); };
        }

        throw new \InvalidArgumentException(
                'Given provider must either be a instance of'
                . ' stubbles\ioc\InjectionProvider or a class name representing'
                . ' such a provider instance.'
        );
    }