Completed
Pull Request — master (#51)
by Бабичев
16:03 queued 08:13
created

ExchangeService   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A rate() 0 6 1
1
<?php
2
3
namespace Bavix\Wallet\Services;
4
5
use Bavix\Wallet\Interfaces\Rateable;
6
use Bavix\Wallet\Interfaces\Wallet;
7
8
class ExchangeService
9
{
10
11
    /**
12
     * @param Wallet $from
13
     * @param Wallet $to
14
     * @return float
15
     */
16 2
    public function rate(Wallet $from, Wallet $to): float
17
    {
18 2
        return app(Rateable::class)
19 2
            ->withAmount(1)
20 2
            ->withCurrency($from)
21 2
            ->convertTo($to);
22
    }
23
24
}
25