CommentsCountComposer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 39
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 7 1
1
<?php namespace Arcanesoft\Blog\ViewComposers\Admin\Dashboard;
2
3
use Arcanesoft\Blog\ViewComposers\AbstractComposer;
4
use Illuminate\Contracts\View\View;
5
6
/**
7
 * Class     CommentsCountComposer
8
 *
9
 * @package  Arcanesoft\Blog\ViewComposers\Dashboard
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class CommentsCountComposer extends AbstractComposer
13
{
14
    /* -----------------------------------------------------------------
15
     |  Constants
16
     | -----------------------------------------------------------------
17
     */
18
19
    const VIEW = 'blog::admin._composers.dashboard.comments-total-box';
20
21
    /* -----------------------------------------------------------------
22
     |  Main Methods
23
     | -----------------------------------------------------------------
24
     */
25
26
    /**
27
     * Compose the view.
28
     *
29
     * @param  \Illuminate\Contracts\View\View  $view
30
     */
31
    public function compose(View $view)
32
    {
33
//        $comments = $this->cachedComments();
34
//        $view->with('', $comments->count());
35
36
        $view->with('commentsCount', rand(1000, 2000));
37
    }
38
39
    /**
40
     * Get the cached comments.
41
     *
42
     * @return \Illuminate\Database\Eloquent\Collection
43
     */
44
//    protected function cachedComments()
45
//    {
46
//        return $this->cacheResults('comments.all', function () {
47
//            return Comment::all();
48
//        });
49
//    }
50
}
51