fabpot/Pimple — pull request #63 by igorw (2013-02-09 07:17:58+00:00)
Title: Introduce static versions of share() and protect()

I have a use case where I want to be able to pass parameters to an object that will then at some point create and initialize a pimple container. Then set the parameters. I want to be able to override defaults, including services.

Essentially, this:

createContainer([
foo => Pimple::shareStatic(function () { return new Foo(); }),
]);

Since the container does not exist yet, I have no instance to call share() on. Therefore, I want static versions of share and protect, so that this use case is supported properly.

I'm open to:

* Removing the docblocks on the static versions
* Finding better names for the static versions
* Just making the existing `share` and `protect` methods static and abuse the fact that PHP allows them to be called dynamically as well