getInboxThreadsPagerfanta()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\Messaging\ThreadProvider\Folder;
12
13
use Miliooo\Messaging\Repository\ThreadRepositoryInterface;
14
use Miliooo\Messaging\User\ParticipantInterface;
15
16
/**
17
 * {@inheritdoc}
18
 */
19
class InboxProviderPagerFanta extends AbstractProviderPagerFanta implements InboxProviderPagerFantaInterface
20
{
21
    /**
22
     * A thread repository instance.
23
     *
24
     * @var ThreadRepositoryInterface
25
     */
26
    protected $threadRepository;
27
28
    /**
29
     * How many items we show per page
30
     *
31
     * @var integer
32
     */
33
    protected $itemsPerPage;
34
35
    /**
36
     * @param ThreadRepositoryInterface $threadRepository A thread repository instance
37
     * @param integer                   $itemsPerPage     Total items per page
38
     */
39
    public function __construct(ThreadRepositoryInterface $threadRepository, $itemsPerPage = 15)
40
    {
41
        $this->threadRepository = $threadRepository;
42
        $this->itemsPerPage = $itemsPerPage;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getInboxThreadsPagerfanta(ParticipantInterface $participant, $currentPage)
49
    {
50
        $queryBuilder = $this->threadRepository->getInboxThreadsForParticipantQueryBuilder($participant);
51
52
        return $this->getPagerfantaObject($queryBuilder, $currentPage, $this->itemsPerPage);
53
    }
54
}
55