walle/wsdl2phpgenerator — pull request #13 by rgantt (2011-11-21 18:17:02+00:00)
Title: Remove dependency on `_` and `gettext` global functions

Hello again!

I modified `Generator` to allow setter-injection of a display callback. This allows us to remove the hard dependency on the `_` and the `gettext` functions that are baked into the `generate.php` and `Generator` scripts. Now the constructor sets the callback to `gettext` by default it it's available; otherwise it's set to null. Either way, it can be overridden manually by passing a callable to `Generator::setDisplayCallback( ... )`.

I noticed that you were implementing the singleton pattern (something I only noticed by looking at the source). To emphasize this, I moved the singleton implementation into its own method as its typically done. In all honesty, this doesn't change much and is simply a matter of preference. It cleans up the constructor and removes a bit of manual exception checking, though.

In line with these changes, I also changed/simplified the example implementation code in the README. I am not checking in tests here, but I did make sure that all my additions/changes were commented.

Thanks!

Ryan