facebook/libphutil — pull request #23 by danielbeardsley (2013-01-31 23:03:06+00:00)
Title: Add pgroup() and pr() to utils.php

__pgroup()__
Group a list of objects by the value of some property. This function is the
same as `mgroup()`, except it operates on the values of object
properties rather than the return values of method calls.
```
@param list List of objects to group by some property value.
@param string Name of a property to select from each array in order to
determine which group it should be placed into.
@param ... Zero or more additional property names, to subgroup the
groups.
@return dict Dictionary mapping distinct property values to lists of
all objects which had that value at the property.
@group util
```
__pr()__
Access an object property, retrieving the value stored there if it exists or
a default if it does not. This function allows you to concisely access a
property which may or may not exist without raising a warning.
```
@param object Object to access.
@param scalar Property to access in the object.
@param wild Default value to return if the property is not present in
the object.
@return wild If $obj[$prop] exists, that value is returned. If not,
$default is returned without raising a warning.
@group util
```