Given a fieldspec and a noun, recursively collect the specified fields into a "data" element - a subclass specific object that can then be trivially converted into the expected response.
Signature
protected function collectFields(RESTNoun
$noun,
array
$fieldspec )
Parameters
$noun
—
object
- The noun we're currently collecting fields from
$fieldspec
—
array
- The nested fields specification that is the result of #format's conversion from a set of "." separated strings
Returns
any
- An opaque object that is understood by the particular buildResponse method of the subclass