Tax   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 17
rs 10
ccs 4
cts 4
cp 1
wmc 2

1 Method

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