Passed
Push — master ( 3d398f...64f30d )
by Brian
02:20
created

Expressions::translate()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 8
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 16
ccs 0
cts 9
cp 0
crap 12
rs 10
1
<?php
2
3
namespace Bmatovu\Ussd\Traits;
4
5
trait Expressions
6
{
7 11
    protected function incExp(string $exp, int $step = 1): string
8
    {
9 11
        return preg_replace_callback('|(\\d+)(?!.*\\d)|', function ($matches) use ($step) {
10 10
            return $matches[1] + $step;
11
        }, $exp);
12
    }
13
}
14