LatestPostsComposer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 1
cbo 1
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A compose() 0 6 1
1
<?php namespace Modules\Blog\Composers\Frontend;
2
3
use Illuminate\Contracts\View\View;
4
use Modules\Blog\Repositories\PostRepository;
5
use Modules\Core\Contracts\Setting;
6
7
class LatestPostsComposer
8
{
9
    /**
10
     * @var PostRepository
11
     */
12
    private $post;
13
    /**
14
     * @var Setting
15
     */
16
    private $setting;
17
18
    public function __construct(PostRepository $post, Setting $setting)
19
    {
20
        $this->post = $post;
21
        $this->setting = $setting;
22
    }
23
24
    public function compose(View $view)
25
    {
26
        $limit = $this->setting->get('blog::latest-posts-amount', locale(), 5);
27
28
        $view->with('latestPosts', $this->post->latest($limit));
29
    }
30
}
31