Completed
Pull Request — master (#58)
by ARCANEDEV
14:17 queued 02:26
created

LogViewerServiceProvider::publishConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php namespace Arcanedev\LogViewer;
2
3
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
4
5
/**
6
 * Class     LogViewerServiceProvider
7
 *
8
 * @package  Arcanedev\LogViewer
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class LogViewerServiceProvider extends ServiceProvider
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Properties
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Vendor name.
19
     *
20
     * @var string
21
     */
22
    protected $vendor  = 'arcanedev';
23
24
    /**
25
     * Package name.
26
     *
27
     * @var string
28
     */
29
    protected $package = 'log-viewer';
30
31
    /* ------------------------------------------------------------------------------------------------
32
     |  Getters & Setters
33
     | ------------------------------------------------------------------------------------------------
34
     */
35
    /**
36
     * Get the base path.
37
     *
38
     * @return string
39
     */
40 1548
    public function getBasePath()
41
    {
42 1548
        return dirname(__DIR__);
43
    }
44
45
    /* ------------------------------------------------------------------------------------------------
46
     |  Main Functions
47
     | ------------------------------------------------------------------------------------------------
48
     */
49
    /**
50
     * Register the service provider.
51
     */
52 1548
    public function register()
53
    {
54 1548
        $this->registerConfig();
55
56 1548
        $this->app->register('Arcanedev\\LogViewer\\Providers\\UtilitiesServiceProvider');
57 1548
        $this->registerLogViewer();
58 1548
        $this->registerAliases();
59
60 1548
        if ($this->app->runningInConsole()) {
61 1548
            $this->app->register('Arcanedev\\LogViewer\\Providers\\CommandsServiceProvider');
62 1161
        }
63 1548
    }
64
65
    /**
66
     * Boot the service provider.
67
     */
68 1548
    public function boot()
69
    {
70 1548
        $this->publishConfig();
0 ignored issues
show
Documentation Bug introduced by
The method publishConfig does not exist on object<Arcanedev\LogView...gViewerServiceProvider>? 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...
71 1548
        $this->publishViews();
0 ignored issues
show
Documentation Bug introduced by
The method publishViews does not exist on object<Arcanedev\LogView...gViewerServiceProvider>? 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...
72 1548
        $this->publishTranslations();
0 ignored issues
show
Documentation Bug introduced by
The method publishTranslations does not exist on object<Arcanedev\LogView...gViewerServiceProvider>? 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...
73 1548
        $this->app->register('Arcanedev\\LogViewer\\Providers\\RouteServiceProvider');
74 1548
    }
75
76
    /**
77
     * Get the services provided by the provider.
78
     *
79
     * @return array
80
     */
81 780
    public function provides()
82 387
    {
83 387
        return [
84 12
            'arcanedev.log-viewer',
85 9
            'Arcanedev\\LogViewer\\Contracts\\LogViewerInterface',
86 9
        ];
87
    }
88
89
    /* ------------------------------------------------------------------------------------------------
90
     |  Services Functions
91
     | ------------------------------------------------------------------------------------------------
92
     */
93
    /**
94
     * Register the log data class.
95
     */
96 1548
    private function registerLogViewer()
97
    {
98 1548
        $this->singleton(
99 1548
            'arcanedev.log-viewer',
100 1548
            'Arcanedev\\LogViewer\\LogViewer'
101 1548
        );
102
103
        $this->bind(
104
            'Arcanedev\\LogViewer\\Contracts\\LogViewerInterface',
105
            'arcanedev.log-viewer'
106 1548
        );
107
108 1548
        // Registering the Facade
109
        $this->alias(
110 1548
            $this->app['config']->get('log-viewer.facade', 'LogViewer'),
111 1548
            'Arcanedev\\LogViewer\\Facades\\LogViewer'
112 1548
        );
113 1548
    }
114
}
115