Completed
Push — master ( 20b252...4d5a46 )
by ARCANEDEV
04:35
created

ViewComposerServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanesoft\Blog\Providers;
2
3
use Arcanedev\Support\ServiceProvider;
4
use Arcanesoft\Blog\ViewComposers\Dashboard;
5
use Illuminate\Contracts\View\Factory as ViewFactory;
6
7
/**
8
 * Class     ViewComposerServiceProvider
9
 *
10
 * @package  Arcanesoft\Blog\Providers
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class ViewComposerServiceProvider extends ServiceProvider
14
{
15
    /* ------------------------------------------------------------------------------------------------
16
     |  Main Functions
17
     | ------------------------------------------------------------------------------------------------
18
     */
19
    /**
20
     * {@inheritdoc}
21
     */
22 6
    public function boot()
23
    {
24 6
        $this->registerDashboardComposers();
25
        //$this->registerOtherComposers();
26 6
    }
27
28
    /* ------------------------------------------------------------------------------------------------
29
     |  Composers
30
     | ------------------------------------------------------------------------------------------------
31
     */
32
    /**
33
     * Register the dashboard composers.
34
     */
35 6
    private function registerDashboardComposers()
36
    {
37 6
        $this->composer(
38 6
            Dashboard\PostsCountComposer::VIEW,
39 4
            Dashboard\PostsCountComposer::class
40 2
        );
41
42 6
        $this->composer(
43 6
            Dashboard\CategoriesCountComposer::VIEW,
44 4
            Dashboard\CategoriesCountComposer::class
45 2
        );
46
47 6
        $this->composer(
48 6
            Dashboard\CategoriesRatiosComposer::VIEW,
49 4
            Dashboard\CategoriesRatiosComposer::class
50 2
        );
51
52 6
        $this->composer(
53 6
            Dashboard\TagsCountComposer::VIEW,
54 4
            Dashboard\TagsCountComposer::class
55 2
        );
56
57 6
        $this->composer(
58 6
            Dashboard\TagsRatiosComposer::VIEW,
59 4
            Dashboard\TagsRatiosComposer::class
60 2
        );
61
62 6
        $this->composer(
63 6
            Dashboard\CommentsCountComposer::VIEW,
64 4
            Dashboard\CommentsCountComposer::class
65 2
        );
66 6
    }
67
68
    /* ------------------------------------------------------------------------------------------------
69
     |  Other Functions
70
     | ------------------------------------------------------------------------------------------------
71
     */
72
    /**
73
     * Register the view composer.
74
     *
75
     * @param  array|string     $views
76
     * @param  \Closure|string  $callback
77
     * @param  int|null         $priority
78
     *
79
     * @return array
80
     */
81 6
    protected function composer($views, $callback, $priority = null)
82
    {
83 6
        return $this->app[ViewFactory::class]->composer($views, $callback, $priority);
84
    }
85
}
86