PartialBench::benchPartial()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
use function Prelude\partial;
4
5
/**
6
 * @Revs(1000)
7
 * @Iterations(10)
8
 */
9
class PartialBench
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    public function benchPartial()
12
    {
13
        $fn = partial(function ($x, $y) {
14
            return $x + $y;
15
        });
16
17
        $rest = $fn(10);
18
        $rest(50);
19
    }
20
21
    public function benchNative()
22
    {
23
        $fn = function ($x) {
24
            return function ($y) use ($x) {
25
                return $x + $y;
26
            };
27
        };
28
29
        $rest = $fn(10);
30
        $rest(50);
31
    }
32
}
33