public function test_map() { $numbers = [1, 2, 3, 4]; $doubles = function ($x) { return 2 * $x; }; $this->assertEquals([2, 4, 6, 8], F\map($doubles, $numbers)); }
function generateClass($name) { $content = F\pipe(F\map('Demo\\block'), F\filter(function ($block) { return in_array($block->type, ['method', 'class']) && !$block->is_internal; }), f\map(function ($block) use($name) { if ($block->type == 'method') { $block->name = ($block->is_static ? $name . '::' : '') . $block->name; } return $block; }), F\map(function ($block) { return ['name' => $block->name, 'md' => markdown($block)]; }), addContents($name), F\join("\n\n")); file_put_contents("docs/{$name}.md", $content(json_decode(shell_exec("dox -r < src/{$name}.php")))); }