Introduce static versions of share() and protect()
merged branch igorw/static-share-protect (PR #63)

This PR was squashed before being merged into the master branch (closes #63).

Commits
-------

f3e834d Introduce static versions of share() and protect()

Discussion
----------

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

---------------------------------------------------------------------------

by fabpot at 2013-02-09T10:54:00Z

Option 3 seems better to me (just making the current methods static).

---------------------------------------------------------------------------

by simensen at 2013-02-09T15:19:18Z

:+1:

Option 3 is my favorite as well.

---------------------------------------------------------------------------

by igorw at 2013-02-09T15:20:50Z

In that case I sincerely hope that PHP does not decide to deprecate that in the future. Updating PR.

---------------------------------------------------------------------------

by igorw at 2013-02-09T15:23:31Z

Done, changed to option 3.