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.

TranslationServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 3
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 16 4
A registerLoader() 0 8 1
1
<?php
2
3
namespace Spatie\TranslationLoader;
4
5
use Illuminate\Support\Str;
6
use Illuminate\Translation\FileLoader;
7
use Illuminate\Translation\TranslationServiceProvider as IlluminateTranslationServiceProvider;
8
9
class TranslationServiceProvider extends IlluminateTranslationServiceProvider
10
{
11
    /**
12
     * Register the application services.
13
     */
14
    public function register()
15
    {
16
        parent::register();
17
18
        $this->mergeConfigFrom(__DIR__.'/../config/translation-loader.php', 'translation-loader');
19
    }
20
21
    /**
22
     * Bootstrap the application services.
23
     */
24
    public function boot()
25
    {
26
        if ($this->app->runningInConsole() && ! Str::contains($this->app->version(), 'Lumen')) {
27
            $this->publishes([
28
                __DIR__.'/../config/translation-loader.php' => config_path('translation-loader.php'),
29
            ], 'config');
30
31
            if (! class_exists('CreateLanguageLinesTable')) {
32
                $timestamp = date('Y_m_d_His', time());
33
34
                $this->publishes([
35
                    __DIR__.'/../database/migrations/create_language_lines_table.php.stub' => database_path('migrations/'.$timestamp.'_create_language_lines_table.php'),
36
                ], 'migrations');
37
            }
38
        }
39
    }
40
41
    /**
42
     * Register the translation line loader. This method registers a
43
     * `TranslationLoaderManager` instead of a simple `FileLoader` as the
44
     * applications `translation.loader` instance.
45
     */
46
    protected function registerLoader()
47
    {
48
        $this->app->singleton('translation.loader', function ($app) {
49
            $class = config('translation-loader.translation_manager');
50
51
            return new $class($app['files'], $app['path.lang']);
52
        });
53
    }
54
}
55