Passed
Push — master ( 22d25f...0b7ff5 )
by Sérgio
02:32
created

PartialBench::benchPartialNativeFn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
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 View Code Duplication
    public function benchPartial2Args()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
    {
13
        $fn = partial(function ($x, $y) {
14
            return $x + $y;
15
        });
16
17
        $rest = $fn(10);
18
        $rest(50);
19
    }
20
21 View Code Duplication
    public function benchNative2Args()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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