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

PackageServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 2
cp 0
rs 9.4286
cc 1
eloc 2
nc 1
nop 0
crap 2
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