Completed
Push — master ( 6aa47e...cf79b7 )
by Ievgen
05:38
created

Always::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 8
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace einfach\operation\step;
4
5
use einfach\operation\Railway;
6
use const einfach\operation\response\RESPONSE_TYPE_OK;
7
use const einfach\operation\response\RESPONSE_TYPE_ERROR;
8
9 View Code Duplication
class Always extends AbstractStep
1 ignored issue
show
Duplication introduced by
This class 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...
10
{
11 6
    public function __invoke(&$params, string $track)
12
    {
13 6
        $response = $this->normalizeStepResponse(call_user_func($this->function, $params));
14
        // run on any track, but not change it to OK, if strated on Error
15 6
        $type = ($track == Railway::TRACK_FAILURE) ? RESPONSE_TYPE_ERROR : $response['type'];
16 6
        $response['type'] = $type;
17 6
        return $response;
18
    }
19
}
20