Skip to content

Commit b021844

Browse files
author
Babichev Maxim
committed
update rate's
1 parent 4380def commit b021844

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Simple/Rate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Rate implements Rateable
1818
protected $amount;
1919

2020
/**
21-
* @var Wallet
21+
* @var Wallet|\Bavix\Wallet\Models\Wallet
2222
*/
2323
protected $withCurrency;
2424

tests/Common/Rate.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ public function __construct()
3737
*/
3838
protected function rate(Wallet $wallet): float
3939
{
40-
$from = $this->withCurrency->slug;
41-
$to = $wallet->slug;
42-
43-
if (Arr::has($this->rates, "$from.$to")) {
44-
return Arr::get($this->rates, "$from.$to");
45-
}
46-
47-
return 1;
40+
/**
41+
* @var \Bavix\Wallet\Models\Wallet $wallet
42+
*/
43+
return Arr::get(
44+
Arr::get($this->rates, $this->withCurrency->slug, []),
45+
$wallet->slug,
46+
1
47+
);
4848
}
4949

5050
/**

0 commit comments

Comments
 (0)