Completed
Push — master ( 4bd1d2...9b1cea )
by yuuki
10s
created

AspectServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
 * THE SOFTWARE.
11
 *
12
 * This software consists of voluntary contributions made by many individuals
13
 * and is licensed under the MIT license.
14
 *
15
 * Copyright (c) 2015-2016 Yuuki Takezawa
16
 *
17
 */
18
namespace Ytake\LaravelAspect;
19
20
use Illuminate\Support\ServiceProvider;
21
22
/**
23
 * Class AspectServiceProvider
24
 */
25
class AspectServiceProvider extends ServiceProvider
26
{
27
    /** @var bool  */
28
    protected $defer = false;
29
30
    /**
31
     * boot aspect kernel
32
     */
33
    public function boot()
34
    {
35
        $this->app['aspect.manager']->dispatch();
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function register()
42
    {
43
        /**
44
         * for package configure
45
         */
46
        $configPath = __DIR__ . '/config/ytake-laravel-aop.php';
47
        $this->mergeConfigFrom($configPath, 'ytake-laravel-aop');
48
        $this->publishes([$configPath => config_path('ytake-laravel-aop.php')], 'aspect');
49
50
        $this->app->singleton('aspect.annotation.reader', function ($app) {
51
            return (new AnnotationManager($app))->getReader();
52
        });
53
54
        $this->app->singleton('aspect.manager', function ($app) {
55
            // register annotation
56
            return new AspectManager($app);
57
        });
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function provides()
64
    {
65
        return [
66
            'aspect.annotation.register',
67
            'aspect.annotation.reader',
68
            'aspect.manager'
69
        ];
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public static function compiles()
76
    {
77
        return [
78
            base_path() . '/vendor/ytake/laravel-aspect/src/AspectServiceProvider.php',
79
            base_path() . '/vendor/ytake/laravel-aspect/src/ConsoleServiceProvider.php',
80
            base_path() . '/vendor/ytake/laravel-aspect/src/AnnotationManager.php',
81
            base_path() . '/vendor/ytake/laravel-aspect/src/Annotation/Reader/AnnotationReadable.php',
82
            base_path() . '/vendor/ytake/laravel-aspect/src/Annotation/Reader/ApcuReader.php',
83
            base_path() . '/vendor/ytake/laravel-aspect/src/Annotation/Reader/ArrayReader.php',
84
            base_path() . '/vendor/ytake/laravel-aspect/src/AspectBind.php',
85
            base_path() . '/vendor/ytake/laravel-aspect/src/AspectDriverInterface.php',
86
            base_path() . '/vendor/ytake/laravel-aspect/src/Annotation/Reader/FileReader.php',
87
            base_path() . '/vendor/ytake/laravel-aspect/src/NullAspectKernel.php',
88
            base_path() . '/vendor/ytake/laravel-aspect/src/RayAspectKernel.php',
89
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CacheablePointCut.php',
90
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CacheEvictPointCut.php',
91
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/CachePutPointCut.php',
92
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/LoggablePointCut.php',
93
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/PointCutable.php',
94
            base_path() . '/vendor/ytake/laravel-aspect/src/PointCut/TransactionalPointCut.php',
95
            base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CacheableModule.php',
96
            base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CacheEvictModule.php',
97
            base_path() . '/vendor/ytake/laravel-aspect/src/Modules/CachePutModule.php',
98
            base_path() . '/vendor/ytake/laravel-aspect/src/Modules/LoggableModule.php',
99
            base_path() . '/vendor/ytake/laravel-aspect/src/Modules/TransactionalModule.php',
100
            base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CacheableInterceptor.php',
101
            base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CacheEvictInterceptor.php',
102
            base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/CachePutInterceptor.php',
103
            base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/LoggableInterceptor.php',
104
            base_path() . '/vendor/ytake/laravel-aspect/src/Interceptor/TransactionalInterceptor.php',
105
        ];
106
    }
107
}
108