public function test_pipe_instance_method() { $upperHello = F\pipe($this->hello, [new ForTest(), 'upper']); $this->assertEquals('HELLO', $upperHello()); }
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")))); }
public function test_allSatisfies() { $allNotNull = F\allSatisfies(F\pipe(F\eq(0), F\not())); $this->assertTrue($allNotNull([9, 3, 2, 4])); $this->assertFalse($allNotNull([9, 3, 0, 4])); }