Exemplo n.º 1
0
 public function test_replace()
 {
     $noSpace = F\replace(' ', '');
     $this->assertEquals('abcdef', $noSpace('a bc d   e f'));
     $this->assertEquals('bcdf', F\replace([' ', 'a', 'e'], '', 'a bc d   e f'));
     $this->assertEquals('cj', F\replace(['a', 'b', 'i'], ['b', 'c', 'j'], 'ai'));
 }
Exemplo n.º 2
0
function generateModule($file)
{
    $content = F\pipe(F\map('Demo\\block'), F\filter(function ($block) {
        return $block->type == 'function' && !$block->is_internal;
    }), F\map(function ($block) {
        return ['name' => $block->name, 'md' => markdown($block)];
    }), addContents(F\replace(['src/', '.php'], '', $file)), F\join("\n\n"));
    file_put_contents(F\replace(['src', '.php'], ['docs', '.md'], $file), $content(json_decode(shell_exec("dox -r < {$file}"))));
}