Always   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 11
loc 11
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 8 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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
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