ChangeCount::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Cart\CountOperation;
5
6
use Cart\Contracts\CounterItemContract;
7
8
/**
9
 * Class ChangeCount
10
 *
11
 * @package CountOperation
12
 */
13
class ChangeCount implements CounterItemContract
14
{
15
16
    /**
17
     * Operation
18
     *
19
     * @param int $before
20
     * @param int $howMuch
21
     * @return int
22
     */
23 1
    public function execute(int $before, int $howMuch): int
24
    {
25 1
        $before = $howMuch;
26 1
        $before < 0 ? $before = 0 : true;
27 1
        return $before;
28
    }
29
}