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::getMigrationFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 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