vojtasvoboda /
oc-cnbrates-plugin
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php namespace VojtaSvoboda\CnbRates; |
||
| 2 | |||
| 3 | use Backend; |
||
| 4 | use System\Classes\PluginBase; |
||
| 5 | use VojtaSvoboda\CnbRates\Models\Settings; |
||
| 6 | |||
| 7 | /** |
||
| 8 | * CnbRates Plugin Information File |
||
| 9 | */ |
||
| 10 | class Plugin extends PluginBase |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Returns information about this plugin. |
||
| 14 | * |
||
| 15 | * @return array |
||
|
1 ignored issue
–
show
|
|||
| 16 | */ |
||
| 17 | public function pluginDetails() |
||
| 18 | { |
||
| 19 | return [ |
||
| 20 | 'name' => 'vojtasvoboda.cnbrates::lang.plugin.name', |
||
| 21 | 'description' => 'vojtasvoboda.cnbrates::lang.plugin.description', |
||
| 22 | 'author' => 'Vojta Svoboda', |
||
| 23 | 'icon' => 'icon-line-chart' |
||
| 24 | ]; |
||
| 25 | } |
||
| 26 | |||
| 27 | public function boot() |
||
| 28 | { |
||
| 29 | $this->app->bind('cnb', 'VojtaSvoboda\CnbRates\Facades\CnbFacade'); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function registerSettings() |
||
| 33 | { |
||
| 34 | return [ |
||
| 35 | 'config' => [ |
||
| 36 | 'label' => 'vojtasvoboda.cnbrates::lang.settings.label', |
||
| 37 | 'icon' => 'icon-line-chart', |
||
| 38 | 'description' => 'vojtasvoboda.cnbrates::lang.settings.description', |
||
| 39 | 'class' => 'VojtaSvoboda\CnbRates\Models\Settings', |
||
| 40 | 'order' => 500 |
||
| 41 | ] |
||
| 42 | ]; |
||
| 43 | } |
||
| 44 | |||
| 45 | public function registerSchedule($schedule) |
||
| 46 | { |
||
| 47 | // Exchange service daily update when allowed by Settings |
||
| 48 | $schedule->call(function () { |
||
| 49 | $cnb = $this->app->make('cnb'); |
||
| 50 | $cnb->updateTodayExchangeRates(); |
||
| 51 | |||
| 52 | })->daily()->when(function () { |
||
| 53 | return !!Settings::get('exchange', true); |
||
| 54 | }); |
||
| 55 | |||
| 56 | // PRIBOR service daily update when allowed by Settings |
||
| 57 | $schedule->call(function () { |
||
| 58 | $cnb = $this->app->make('cnb'); |
||
| 59 | $cnb->updateTodayPriborRates(); |
||
| 60 | |||
| 61 | })->daily()->when(function () { |
||
| 62 | return !!Settings::get('pribor', true); |
||
| 63 | }); |
||
| 64 | } |
||
| 65 | |||
| 66 | } |
||
|
0 ignored issues
–
show
|
|||
| 67 |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.