Implements array_reduce functionality.

Requires next changes in Doctrine/Common/Collections/ArrayCollection:
https://github.com/imenem/common/commit/05b82cd94956db73cd2233ab3f0cb319a0be4d5e