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
Pull Request — master (#688)
by
unknown
18:52
created

SleepingOwlServiceProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Test Coverage

Coverage 94%

Importance

Changes 2
Bugs 2 Features 0
Metric Value
wmc 7
lcom 1
cbo 8
dl 0
loc 77
ccs 47
cts 50
cp 0.94
rs 10
c 2
b 2
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
A boot() 0 16 2
A registerCore() 0 5 1
A createLocalViewFactory() 0 12 1
A registerCommands() 0 23 2
1
<?php
2
3
namespace SleepingOwl\Admin\Providers;
4
5
use Illuminate\View\Factory;
6
use SleepingOwl\Admin\Admin;
7
use Illuminate\View\FileViewFinder;
8
use Illuminate\View\Engines\PhpEngine;
9
use Illuminate\View\Engines\EngineResolver;
10
11
class SleepingOwlServiceProvider extends AdminSectionsServiceProvider
12
{
13 285
    public function register()
14
    {
15 285
        $this->mergeConfigFrom(__DIR__.'/../../config/sleeping_owl.php', 'sleeping_owl');
16 285
        $this->loadViewsFrom(__DIR__.'/../../resources/views', 'sleeping_owl');
17
18 285
        $this->registerCore();
19 285
        $this->registerCommands();
20 285
    }
21
22
    /**
23
     * @param Admin $admin
24
     */
25 285
    public function boot(Admin $admin)
26
    {
27 285
        $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'sleeping_owl');
28
29 285
        if ($this->app->runningInConsole()) {
30 285
            $this->publishes([
31 285
                __DIR__.'/../../public' => public_path('packages/sleepingowl/'),
32 285
            ], 'assets');
33
34 285
            $this->publishes([
35 285
                __DIR__.'/../../config/sleeping_owl.php' => config_path('sleeping_owl.php'),
36 285
            ], 'config');
37 285
        }
38
39 285
        parent::boot($admin);
40 285
    }
41
42 285
    protected function registerCore()
43
    {
44 285
        $this->app->instance('sleeping_owl', $admin = new Admin($this->app));
45 285
        $admin->setTemplate($this->app['sleeping_owl.template']);
46 285
    }
47
48
    /**
49
     * @return Factory
50
     */
51 285
    private function createLocalViewFactory()
52
    {
53 285
        $resolver = new EngineResolver();
54
        $resolver->register('php', function () {
55
            return new PhpEngine();
56 285
        });
57 285
        $finder = new FileViewFinder($this->app['files'], [__DIR__.'/../../resources/views']);
58 285
        $factory = new Factory($resolver, $finder, $this->app['events']);
59 285
        $factory->addExtension('php', 'php');
60
61 285
        return $factory;
62 285
    }
63
64 285
    protected function registerCommands()
65
    {
66 285
        if ($this->app->runningInConsole()) {
67 285
            $this->commands([
68 285
                \SleepingOwl\Admin\Console\Commands\InstallCommand::class,
69 285
                \SleepingOwl\Admin\Console\Commands\UpdateCommand::class,
70 285
                \SleepingOwl\Admin\Console\Commands\UserManagerCommand::class,
71 285
                \SleepingOwl\Admin\Console\Commands\SectionGenerate::class,
72 285
                \SleepingOwl\Admin\Console\Commands\SectionMake::class,
73 285
                \SleepingOwl\Admin\Console\Commands\SectionProvider::class,
74 285
            ]);
75
76 285
            $localViewFactory = $this->createLocalViewFactory();
77 285
            $this->app->singleton(
78 285
                'command.sleepingowl.ide.generate',
79
                function ($app) use ($localViewFactory) {
80
                    return new \SleepingOwl\Admin\Console\Commands\GeneratorCommand($app['config'], $app['files'], $localViewFactory);
81
                }
82 285
            );
83
84 285
            $this->commands('command.sleepingowl.ide.generate');
85 285
        }
86 285
    }
87
}
88