Completed
Pull Request — master (#51)
by Бабичев
07:54
created

Rate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 37
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A withAmount() 0 4 1
A convertTo() 0 3 1
A withCurrency() 0 4 1
1
<?php
2
3
namespace Bavix\Wallet\Simple;
4
5
use Bavix\Wallet\Interfaces\Rateable;
6
use Bavix\Wallet\Interfaces\Wallet;
7
8
/**
9
 * Class Rate
10
 * @package Bavix\Wallet\Simple
11
 * @codeCoverageIgnore
12
 */
13
class Rate implements Rateable
14
{
15
16
    /**
17
     * @var int
18
     */
19
    protected $amount;
20
21
    /**
22
     * @var Wallet
23
     */
24
    protected $withCurrency;
25
26
    /**
27
     * @inheritDoc
28
     */
29
    public function withAmount(int $amount): Rateable
30
    {
31
        $this->amount = $amount;
32
        return $this;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function withCurrency(Wallet $wallet): Rateable
39
    {
40
        $this->withCurrency = $wallet;
41
        return $this;
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function convertTo(Wallet $wallet): float
48
    {
49
        return $this->amount;
50
    }
51
52
}
53