Passed
Push — master ( 2564c1...9453fd )
by Orkhan
02:47
created

Currency   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rates() 0 3 1
A rate() 0 3 1
1
<?php
2
3
namespace Orkhanahmadov\LaravelCurrencylayer\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\HasMany;
7
8
class Currency extends Model
9
{
10
    protected $table = 'currencylayer_currencies';
11
12
    public $timestamps = false;
13
14
    protected $fillable = [
15
        'name',
16
        'code',
17
    ];
18
19
    public function rates(): HasMany
20
    {
21
        return $this->hasMany(Rate::class, 'source_currency_id');
22
    }
23
24
    public function rate(Currency $target, $date = null)
0 ignored issues
show
Unused Code introduced by
The parameter $date is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

24
    public function rate(Currency $target, /** @scrutinizer ignore-unused */ $date = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        return $this->targetRates()->where('target_currency_id', $target->id)->orderByDesc('rate_for')->first();
27
    }
28
}
29