First::step()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Arnaud LEMAIRE  <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Fp\Reducer;
13
14
class First implements Reducer
15
{
16
    use Mixin\Stateless;
17
    use Mixin\WithCallback;
18
19 3
    public function step($result, $current)
20
    {
21 3
        if ($this->callback->__invoke($current)) {
0 ignored issues
show
Bug introduced by
The method __invoke cannot be called on $this->callback (of type callable).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
22 3
            return new Reduced($this->next_reducer->step($result, $current));
23
        }
24
25 3
        return $result;
26
    }
27
28
}
29