Пример #1
0
 public function test_return()
 {
     $countArgs = function () {
         return func_num_args();
     };
     $this->assertInstanceOf(Closure, P\unary($countArgs), 'unary should return a closure');
     $this->assertEquals(1, P\unary($countArgs)->__invoke(1, 2, 3), 'Unary should eat all but one argument');
 }
Пример #2
0
<section>
    <h2>Testing Quaternary!</h2>
    <p>
        <?php 
$output = call_user_func_array($quaternary($testFn), testData);
?>
        Quaternary returned: <?php 
echo $output;
?>
    </p>
</section>
<section>
    <h2>Testing Unary</h2>
    <p>
        <?php 
$output = call_user_func_array(P\unary($testFn), testData);
?>
        Unary returned: <?php 
echo $output;
?>

    </p>
</section>
<section>
    <h2>Currying native function test. Target: array_map</h2>
    <p>
        <?php 
echo $jsonTestData;
?>
 &mdash;$map2x&rightarrow; <?php 
echo json_encode($mapX2(testData));