ArchivedProviderPagerFanta   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getArchivedThreadsPagerfanta() 0 6 1
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 ArchivedProviderPagerFanta extends AbstractProviderPagerFanta implements ArchivedProviderPagerFantaInterface
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
     * Constructor.
37
     *
38
     * @param ThreadRepositoryInterface $threadRepository A thread repository instance
39
     * @param integer                   $itemsPerPage     Total items per page
40
     */
41
    public function __construct(ThreadRepositoryInterface $threadRepository, $itemsPerPage = 15)
42
    {
43
        $this->threadRepository = $threadRepository;
44
        $this->itemsPerPage = $itemsPerPage;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getArchivedThreadsPagerfanta(ParticipantInterface $participant, $currentPage)
51
    {
52
        $queryBuilder = $this->threadRepository->getArchivedThreadsForParticipantQueryBuilder($participant);
53
54
        return $this->getPagerfantaObject($queryBuilder, $currentPage, $this->itemsPerPage);
55
    }
56
}
57