Completed
Pull Request — master (#2)
by ARCANEDEV
02:57
created

PackageServiceProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 92.86%

Importance

Changes 6
Bugs 0 Features 0
Metric Value
wmc 7
c 6
b 0
f 0
lcom 1
cbo 2
dl 0
loc 82
ccs 26
cts 28
cp 0.9286
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 1
A boot() 0 4 1
A provides() 0 6 1
A registerSettingsPackage() 0 5 1
A registerHasherPackage() 0 4 1
A registerBreadcrumbsPackage() 0 4 1
A registerLogViewerPackage() 0 11 1
1
<?php namespace Arcanesoft\Foundation\Providers;
2
3
use Arcanedev\Support\ServiceProvider;
4
5
/**
6
 * Class     PackageServiceProvider
7
 *
8
 * @package  Arcanesoft\Foundation\Providers
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class PackageServiceProvider extends ServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Register the service provider.
19
     */
20 18
    public function register()
21
    {
22 18
        $this->registerSettingsPackage();
23 18
        $this->registerHasherPackage();
24 18
        $this->registerBreadcrumbsPackage();
25 18
        $this->registerLogViewerPackage();
26 18
        $this->registerAliases();
0 ignored issues
show
Documentation Bug introduced by
The method registerAliases does not exist on object<Arcanesoft\Founda...PackageServiceProvider>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
27 18
    }
28
29
    /**
30
     * Boot the service provider.
31
     */
32 18
    public function boot()
33
    {
34
        //
35 18
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41
     */
42
    public function provides()
43
    {
44
        return [
45
            //
46
        ];
47
    }
48
49
    /* ------------------------------------------------------------------------------------------------
50
     |  Package Functions
51
     | ------------------------------------------------------------------------------------------------
52
     */
53
    /**
54
     * Register the Settings Package.
55
     */
56 18
    private function registerSettingsPackage()
57
    {
58 18
        $this->app->register(\Arcanedev\Settings\SettingsServiceProvider::class);
59 18
        $this->alias('Setting', \Arcanedev\Settings\Facades\Setting::class);
0 ignored issues
show
Documentation Bug introduced by
The method alias does not exist on object<Arcanesoft\Founda...PackageServiceProvider>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
60 18
    }
61
62
    /**
63
     * Register the Hasher Package.
64
     */
65 18
    private function registerHasherPackage()
66
    {
67 18
        $this->app->register(\Arcanedev\Hasher\HasherServiceProvider::class);
68 18
    }
69
70
    /**
71
     * Register the Breadcrumbs Package.
72
     */
73 18
    private function registerBreadcrumbsPackage()
74
    {
75 18
        $this->app->register(\Arcanedev\Breadcrumbs\BreadcrumbsServiceProvider::class);
76 18
    }
77
78
    /**
79
     * Register the LogViewer Package.
80
     */
81 18
    private function registerLogViewerPackage()
82
    {
83 18
        $this->app->register(\Arcanedev\LogViewer\LogViewerServiceProvider::class);
84
85
        // Setting up the LogViewer config.
86 18
        $this->app['config']->set('log-viewer.route.enabled', false);
87 18
        $this->app['config']->set(
88 18
            'log-viewer.menu.filter-route',
89
            'foundation::log-viewer.logs.filter'
90 18
        );
91 18
    }
92
}
93