Completed
Push — master ( c88daf...3b4433 )
by Vojta
12:17
created

Plugin.php (1 issue)

Upgrade to new PHP Analysis Engine

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 1
 * CnbRates Plugin Information File
9
 */
10
class Plugin extends PluginBase
11 1
{
12 1
    /**
13
     * Returns information about this plugin.
14 1
     *
15
     * @return array
16
     */
17 2
    public function pluginDetails()
18
    {
19
        return [
20 1
            'name' => 'vojtasvoboda.cnbrates::lang.plugin.name',
21 2
            'description' => 'vojtasvoboda.cnbrates::lang.plugin.description',
22 1
            'author' => 'Vojta Svoboda',
23 1
            'icon' => 'icon-line-chart'
24 2
        ];
25
    }
26
27 1
    public function boot()
28
    {
29
        $this->app->bind('cnb', 'VojtaSvoboda\CnbRates\Facades\CnbFacade');
30
    }
31 1
32
    public function registerSettings()
33 1
    {
34 1
        return [
35
            'config' => [
36
                'label' => 'vojtasvoboda.cnbrates::lang.settings.label',
37 1
                'icon' => 'icon-line-chart',
38
                'description' => 'vojtasvoboda.cnbrates::lang.settings.description',
39
                'class' => 'VojtaSvoboda\CnbRates\Models\Settings',
40
                'order' => 500
41 1
            ]
42 1
        ];
43 1
    }
44 1
45 1
    public function registerSchedule($schedule)
46
    {
47
        // Exchange service daily update when allowed by Settings
48
        $schedule->call(function () {
49 1
            $cnb = $this->app->make('cnb');
50 1
            $cnb->updateTodayExchangeRates();
51 1
52 1
        })->daily()->when(function () {
53 1
            return !!Settings::get('exchange', true);
54
        });
55 1
56 1
        // PRIBOR service daily update when allowed by Settings
57 1
        $schedule->call(function () {
58 1
            $cnb = $this->app->make('cnb');
59 1
            $cnb->updateTodayPriborRates();
60
61 1
        })->daily()->when(function () {
62 1
            return !!Settings::get('pribor', true);
63
        });
64
    }
65
66
}
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
67