Completed
Push — develop ( c05732...6c11b8 )
by Abdelrahman
01:50
created

RepositoryServiceProvider::prepareRepositoryAlias()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 3
eloc 5
nc 2
nop 2
1
<?php
2
3
/*
4
 * NOTICE OF LICENSE
5
 *
6
 * Part of the Rinvex Repository Package.
7
 *
8
 * This source file is subject to The MIT License (MIT)
9
 * that is bundled with this package in the LICENSE file.
10
 *
11
 * Package: Rinvex Repository Package
12
 * License: The MIT License (MIT)
13
 * Link:    https://rinvex.com
14
 */
15
16
namespace Rinvex\Repository\Providers;
17
18
use Illuminate\Support\ServiceProvider;
19
use Rinvex\Repository\Listeners\RepositoryEventListener;
20
21
class RepositoryServiceProvider extends ServiceProvider
22
{
23
    /**
24
     * The repository alias pattern.
25
     *
26
     * @var string
27
     */
28
    protected $repositoryAliasPattern = '{{class}}Contract';
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $repositoryAliasPattern exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function register()
34
    {
35
        // Merge config
36
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.repository');
37
38
        // Register the event listener
39
        $this->app->bind('rinvex.repository.listener', RepositoryEventListener::class);
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function boot()
46
    {
47
        // Publish Resources
48
        $this->publishResources();
49
50
        // Subscribe the registered event listener
51
        $this->app['events']->subscribe('rinvex.repository.listener');
52
    }
53
54
    /**
55
     * Publish package resources.
56
     *
57
     * @return void
58
     */
59
    protected function publishResources()
60
    {
61
        // Publish config
62
        $this->publishes([
63
            realpath(__DIR__.'/../../config/config.php') => config_path('rinvex.repository.php'),
64
        ], 'config');
65
    }
66
}
67