PercentageStrategy::make()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Cart\DiscountStrategy;
5
6
use Cart\Contracts\DiscountContract;
7
8
class PercentageStrategy implements DiscountContract
9
{
10
    /**
11
     * @var int
12
     */
13
    protected $sign;
14
15 1
    public function __construct(int $sign)
16
    {
17 1
        $this->sign = $sign;
18 1
    }
19
20
    /**
21
     * Make Discount
22
     *
23
     * @param int $basePrice
24
     * @return float
25
     */
26 1
    public function make(int $basePrice): float
27
    {
28 1
        return $basePrice / 100 * $this->sign;
29
    }
30
}