Rate   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
1
<?php 
2
3
declare(strict_types=1);
4
5
namespace Elvendor\Tcmb\Http\Controllers;
6
7
use Elvendor\Tcmb\Models\ExchangeRate;
8
use Illuminate\Http\Request;
9
use Illuminate\Routing\Controller;
10
use Elvendor\Tcmb\Http\Resources\ExchangeRateResource;
11
12
class Rate extends Controller
13
{
14
    public function __invoke(Request $request)
15
    {
16
        $rates = ExchangeRate::whereNotNull('rates')
0 ignored issues
show
Unused Code introduced by
The assignment to $rates is dead and can be removed.
Loading history...
17
            ->actualForDate($request->input('date', date('Y-m-d')))
18
            ->orderByDesc('date')
19
            ->first();
20
        return new ExchangeRateResource($rate);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $rate does not exist. Did you maybe mean $rates?
Loading history...
21
    }
22
}
23