Ejemplo n.º 1
0
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"))));
}
Ejemplo n.º 2
0
 public function test_satisfiesAny()
 {
     $persons = [['name' => 'foo', 'age' => 11], ['name' => 'bar', 'age' => 9], ['name' => 'baz', 'age' => 16], ['name' => 'zeta', 'age' => 33], ['name' => 'beta', 'age' => 25]];
     $isValid = F\satisfiesAny(['name' => F\startsWith('b'), 'age' => F\gt(F\__(), 15)]);
     $this->assertEquals([['name' => 'bar', 'age' => 9], ['name' => 'baz', 'age' => 16], ['name' => 'zeta', 'age' => 33], ['name' => 'beta', 'age' => 25]], F\filter($isValid, $persons));
 }
Ejemplo n.º 3
0
 public function test_filter()
 {
     $array = [1, 'aa', 3, [4, 5]];
     $numeric = F\filter('is_numeric');
     $this->assertEquals([1, 3], $numeric($array));
 }