RallyServiceProvider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 51
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 5 1
A register() 0 3 1
A setupConfig() 0 9 1
A setupMigrations() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of questocat/laravel-rally package.
5
 *
6
 * (c) questocat <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Questocat\Rally;
13
14
use Illuminate\Support\ServiceProvider;
15
16
class RallyServiceProvider extends ServiceProvider
17
{
18
    /**
19
     * Indicates if loading of the provider is deferred.
20
     *
21
     * @var bool
22
     */
23
    protected $defer = false;
24
25
    /**
26
     * Bootstrap the application events.
27
     */
28
    public function boot()
29
    {
30
        $this->setupConfig();
31
        $this->setupMigrations();
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function register()
38
    {
39
    }
40
41
    /**
42
     * Setup the config.
43
     */
44
    protected function setupConfig()
45
    {
46
        $source = realpath(__DIR__.'/../config/rally.php');
47
        $this->publishes([
48
            $source => config_path('rally.php'),
49
        ], 'config');
50
51
        $this->mergeConfigFrom($source, 'rally');
52
    }
53
54
    /**
55
     * Setup the migrations.
56
     */
57
    protected function setupMigrations()
58
    {
59
        $timestamp = date('Y_m_d_His');
60
        $migrationsSource = realpath(__DIR__.'/../database/migrations/create_followables_table.php');
61
        $migrationsTarget = database_path("/migrations/{$timestamp}_create_followables_table.php");
62
        $this->publishes([
63
            $migrationsSource => $migrationsTarget,
64
        ], 'migrations');
65
    }
66
}
67