Test Setup Failed
Push — master ( 584547...730ac2 )
by Alexey
14:04
created

PublicFeedController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 19 1
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\Controller;
4
5
use Knp\Component\Pager\Paginator;
6
use Skobkin\Bundle\PointToolsBundle\Repository\Blogs\PostRepository;
7
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
8
use Symfony\Component\HttpFoundation\Request;
9
10
class PublicFeedController extends AbstractController
11
{
12
    private const POSTS_PER_PAGE = 20;
13
14
    public function indexAction(Request $request, PostRepository $postRepository, Paginator $paginator)
15
    {
16
        $postsPagination = $paginator->paginate(
17
            $postRepository->createPublicFeedPostsQuery(),
18
            $request->query->getInt('page', 1),
19
            self::POSTS_PER_PAGE
20
        );
21
22
        return $this->render(
23
            'SkobkinPointToolsBundle:Post:feed.html.twig',
24
            [
25
                // @todo Move to translation
26
                'feed_title' => 'All',
27
                'posts' => $postsPagination,
28
                // Special feed mark (to not show comments and other)
29
                'is_feed' => true,
30
            ]
31
        );
32
    }
33
}
34