public function getFieldsAsString() { $fields = array_keys($this->_attributes); $escapedFields = Arrays::map($fields, Functions::compose(Functions::append("'"), Functions::prepend("'"))); for ($index = self::FIELDS_COUNT_IN_LINE; $index < sizeof($escapedFields); $index += self::FIELDS_COUNT_IN_LINE) { $escapedFields[$index] = "\n\t\t\t" . $escapedFields[$index]; } return implode(', ', $escapedFields); }
/** * @test */ public function shouldComposeFunctions() { //given $functionA = Functions::trim(); $functionB = Functions::append('a '); //when $result = Functions::call(Functions::compose($functionA, $functionB), ' '); //then $this->assertEquals('a', $result); }