Passed
Push — master ( 38cc9b...2ce834 )
by Moecasts
03:22
created

Tax   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 17
ccs 4
cts 4
cp 1
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 Moecasts\Laravel\Wallet;
4
5
use Moecasts\Laravel\Wallet\Interfaces\Taxing;
6
use Moecasts\Laravel\Wallet\Interfaces\Transferable;
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 10
    public static function fee(Transferable $transferable, Wallet $wallet,float $amount): float
20
    {
21 10
        if ($transferable instanceof Taxing) {
22 1
            return (float) ($amount * $wallet->coefficient($wallet->currency) * $transferable->getFeePercent() / 100);
23
        }
24
25 9
        return 0;
26
    }
27
28
}
29