orkhanahmadov /
laravel-currencylayer
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Orkhanahmadov\LaravelCurrencylayer\Commands; |
||||
| 4 | |||||
| 5 | use Orkhanahmadov\LaravelCurrencylayer\Contracts\CurrencyService; |
||||
| 6 | |||||
| 7 | class LiveCommand extends Command |
||||
| 8 | { |
||||
| 9 | /** |
||||
| 10 | * The name and signature of the console command. |
||||
| 11 | * |
||||
| 12 | * @var string |
||||
| 13 | */ |
||||
| 14 | protected $signature = 'currencylayer:live |
||||
| 15 | {source : Source currency code} |
||||
| 16 | {currencies* : Target currency codes}'; |
||||
| 17 | |||||
| 18 | /** |
||||
| 19 | * The console command description. |
||||
| 20 | * |
||||
| 21 | * @var string |
||||
| 22 | */ |
||||
| 23 | protected $description = 'Gets live rates for currencies'; |
||||
| 24 | |||||
| 25 | /** |
||||
| 26 | * Execute the console command. |
||||
| 27 | * |
||||
| 28 | * @param CurrencyService $currencyService |
||||
| 29 | */ |
||||
| 30 | public function handle(CurrencyService $currencyService): void |
||||
| 31 | { |
||||
| 32 | /** |
||||
| 33 | * @var array|float |
||||
| 34 | */ |
||||
| 35 | $rates = $currencyService->live( |
||||
| 36 | /** |
||||
| 37 | * @var string |
||||
| 38 | */ |
||||
| 39 | $source = $this->argument('source'), |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 40 | /** |
||||
| 41 | * @var array |
||||
| 42 | */ |
||||
| 43 | $currencies = $this->argument('currencies') |
||||
| 44 | ); |
||||
| 45 | |||||
| 46 | $this->output( |
||||
| 47 | 'Live '.$source.' rates', |
||||
|
0 ignored issues
–
show
Are you sure
$source of type null|string|string[] can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 48 | $this->prepareRows($currencies, $rates) |
||||
|
0 ignored issues
–
show
It seems like
$currencies can also be of type null and string; however, parameter $currencies of Orkhanahmadov\LaravelCur...\Command::prepareRows() does only seem to accept array, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 49 | ); |
||||
| 50 | } |
||||
| 51 | } |
||||
| 52 |