public function testFnPipeWithMultipleArgumentsInFirstFunction() { $fnAdd = function ($a, $b) { return $a + $b; }; $fnIncrease = function ($v) { return $v + 1; }; $fnChain = fn\fnPipe($fnAdd, $fnIncrease, $fnIncrease, $fnIncrease); $this->assertEquals(8, $fnChain(2, 3)); }
/** * Generates a function that pulls a value from a field in the document and passes it to $fnMap. * * @param string $fieldName * @param Closure $fnMap($fieldValue) * @return Closure */ function fnMapFromField($fieldName, $fnMap) { return fn\fnPipe(fn\fnPluck($fieldName), $fnMap); }