ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 22
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 20
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 25
ccs 22
cts 22
cp 1
crap 2
rs 9.6
1
<?php
2
3
namespace MyriadDataStore;
4
5
use MyriadDataStore\Console\Commands\DownloadAllMyriadOrdersBasic;
6
use MyriadDataStore\Console\Commands\DownloadLatestMyriadContacts;
7
use MyriadDataStore\Console\Commands\DownloadMyriadContact;
8
use MyriadDataStore\Console\Commands\DownloadMyriadContactOrdersBasic;
9
use MyriadDataStore\Console\Commands\DownloadMyriadContacts;
10
use MyriadDataStore\Console\Commands\DownloadMyriadContactTypes;
11
use MyriadDataStore\Console\Commands\DownloadMyriadDespatchTypes;
12
use MyriadDataStore\Console\Commands\DownloadMyriadIssues;
13
use MyriadDataStore\Console\Commands\DownloadMyriadOrderPackageTypes;
14
use MyriadDataStore\Console\Commands\DownloadMyriadOrdersBasicForContacts;
15
use MyriadDataStore\Console\Commands\DownloadMyriadOrderStatusTypes;
16
use MyriadDataStore\Console\Commands\DownloadMyriadProductTypes;
17
use MyriadDataStore\Console\Commands\DownloadMyriadTitles;
18
use MyriadDataStore\Console\Commands\SetIssuesDatesForPackages;
19
20
class ServiceProvider extends \Illuminate\Support\ServiceProvider
21
{
22 27
    public function boot()
23
    {
24 27
        if ($this->app->runningInConsole()) {
25 27
            $this->publishes([
26 27
                __DIR__.'/../config/myriad-data-store.php' => config_path('myriad-data-store.php'),
27 27
            ], 'config');
28
29 27
            $this->commands([
30 27
                DownloadMyriadContact::class,
31 27
                DownloadMyriadContacts::class,
32 27
                DownloadMyriadProductTypes::class,
33 27
                DownloadMyriadDespatchTypes::class,
34 27
                DownloadMyriadOrderPackageTypes::class,
35 27
                DownloadMyriadOrderStatusTypes::class,
36 27
                DownloadMyriadTitles::class,
37 27
                DownloadMyriadIssues::class,
38 27
                DownloadMyriadContactOrdersBasic::class,
39 27
                DownloadMyriadOrdersBasicForContacts::class,
40 27
                DownloadMyriadContactTypes::class,
41 27
                DownloadLatestMyriadContacts::class,
42 27
                SetIssuesDatesForPackages::class,
43 27
                DownloadAllMyriadOrdersBasic::class,
44 27
            ]);
45
46 27
            $this->registerMigrations();
47
        }
48
    }
49
50
    /**
51
     * @inheritDoc
52
     */
53 27
    public function register()
54
    {
55 27
        $this->mergeConfigFrom(__DIR__.'/../config/myriad-data-store.php', 'myriad-data-store');
56
    }
57
58
    /**
59
     * Register the package migrations.
60
     *
61
     * @return void
62
     */
63 27
    protected function registerMigrations()
64
    {
65 27
        if (MyriadDataDownloader::$runsMigrations) {
66 27
            $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
67
        }
68
    }
69
}
70