GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 31c604...718d40 )
by Pascal
01:18
created

ServiceProvider   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 56
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 24 3
A getMigrationFileName() 0 11 1
A register() 0 4 1
1
<?php
2
3
namespace ProtoneMedia\LaravelVerifyNewEmail;
4
5
use Illuminate\Filesystem\Filesystem;
6
use Illuminate\Support\Collection;
7
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
8
9
class ServiceProvider extends BaseServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     */
14
    public function boot(Filesystem $filesystem)
15
    {
16
        $this->loadViewsFrom(__DIR__ . '/../resources/views', 'verify-new-email');
17
18
        if (!config('verify-new-email.route')) {
19
            $this->loadRoutesFrom(__DIR__ . '/routes.php');
20
        }
21
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__ . '/../database/migrations/create_pending_user_emails_table.php.stub' => $this->getMigrationFileName($filesystem),
25
            ], 'migrations');
26
27
            $this->publishes([
28
                __DIR__ . '/../config/config.php' => config_path('verify-new-email.php'),
29
            ], 'config');
30
31
            $this->publishes([
32
                __DIR__ . '/../resources/views' => resource_path('views/vendor/verify-new-email'),
33
            ], 'views');
34
35
            // $this->commands([]);
36
        }
37
    }
38
39
    /**
40
     * Returns existing migration file if found, else uses the current timestamp.
41
     *
42
     * @param Filesystem $filesystem
43
     * @return string
44
     */
45
    protected function getMigrationFileName(Filesystem $filesystem): string
46
    {
47
        $timestamp = date('Y_m_d_His');
48
49
        return Collection::make($this->app->databasePath('migrations') . DIRECTORY_SEPARATOR)
50
            ->flatMap(function ($path) use ($filesystem) {
51
                return $filesystem->glob("{$path}*_create_pending_user_emails_table.php");
52
            })
53
            ->push($this->app->databasePath("migrations/{$timestamp}_create_pending_user_emails_table.php"))
54
            ->first();
55
    }
56
57
    /**
58
     * Register the application services.
59
     */
60
    public function register()
61
    {
62
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'verify-new-email');
63
    }
64
}
65