Completed
Push — version-4 ( 449bed...ddf616 )
by Tyler
04:02
created

handleDeprecatedConfigValues()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3.0067

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
ccs 10
cts 11
cp 0.9091
rs 9.4285
cc 3
eloc 7
nc 3
nop 0
crap 3.0067
1
<?php
2
3
namespace Tylercd100\LERN;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class LERNServiceProvider extends ServiceProvider
8
{
9 84
    public function register()
10
    {
11 84
        $this->mergeConfigFrom(__DIR__.'/../config/lern.php', 'lern');
12
13 84
        $this->handleDeprecatedConfigValues();
14
15 84
        $this->app->singleton('lern', function () {
16 3
            return new LERN;
17 84
        });
18 84
    }
19
20 84
    public function boot()
21
    {
22 84
        $this->publishes([
23 84
            __DIR__.'/../views/exceptions/default.blade.php' => base_path('resources/views/exceptions/default.blade.php'),
24 84
            __DIR__.'/../migrations/2016_03_17_000000_create_lern_tables.php' => base_path('database/migrations/2016_03_17_000000_create_lern_tables.php'),
25 84
            __DIR__.'/../migrations/2016_03_27_000000_add_user_data_and_url_to_lern_tables.php' => base_path('database/migrations/2016_03_27_000000_add_user_data_and_url_to_lern_tables.php'),
26 84
            __DIR__.'/../config/lern.php' => base_path('config/lern.php'),
27 84
        ]);
28 84
    }
29
30 84
    protected function handleDeprecatedConfigValues()
31
    {
32
        $renamedConfigValues = [
33
            [
34 84
                'oldName' => 'lern.notify.pushover.user',
35 84
                'newName' => 'lern.notify.pushover.users',
36 84
            ],
37 84
        ];
38
39 84
        foreach ($renamedConfigValues as $renamedConfigValue) {
40 84
            if (config($renamedConfigValue['oldName'])) {
41
                config([$renamedConfigValue['newName'] => config($renamedConfigValue['oldName'])]);
42 3
            }
43 84
        }
44
    }
45
}