brianhaveri/Underscore.php — pull request #7 by MirkoBonadei (2012-04-10 11:10:23+00:00)
Title: Added  Utility function oneOf

To cleanup code in a project I am working on, I have implemented the oneOf function with its own tests into the UtilityTest file, and I have decided to push it back to your project.

The purpose is to return the first argument which is not null, and it is able to receive not only standard values but callable and Exceptions too.

So, it the first argument which is not null is an exception it will throw it, if it is a callable it will execute it returning the result if it is not null.

Cheers