Stateless::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Fp\Reducer\Mixin;
4
/**
5
 * Created by PhpStorm.
6
 * User: alemaire
7
 * Date: 17/03/2016
8
 * Time: 20:57
9
 */
10
trait Stateless
11
{
12 12
    public function init()
13
    {
14 12
        return $this->next_reducer->init();
0 ignored issues
show
Bug introduced by
The property next_reducer does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
15
    }
16
17
    abstract function step($result, $current);
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
19 12
    public function complete($result)
20
    {
21 12
        return $this->next_reducer->complete($result);
22
    }
23
}