Test Failed
Pull Request — master (#14)
by Бабичев
02:49
created

Tax   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 17
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fee() 0 7 2
1
<?php
2
3
namespace Bavix\Wallet;
4
5
use Bavix\Wallet\Interfaces\Taxing;
6
use Bavix\Wallet\Interfaces\Wallet;
7
8
class Tax
9
{
10
11
    /**
12
     * Consider the fee that the system will receive.
13
     *
14
     * @param Wallet $wallet
15
     * @param int $amount
16
     * @return int
17
     */
18 9
    public static function fee(Wallet $wallet, int $amount): int
19
    {
20 9
        if ($wallet instanceof Taxing) {
21
            return (int) ($amount * $wallet->getFeePercent() / 100);
22
        }
23
24 9
        return 0;
25
    }
26
27
}
28