OutboxProviderPagerFanta::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 5
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
 * Outbox provider for pagerfanta pagination
18
 *
19
 * @author Michiel Boeckaert <[email protected]>
20
 */
21
class OutboxProviderPagerFanta extends AbstractProviderPagerFanta implements OutboxProviderPagerFantaInterface
22
{
23
    /**
24
     * A thread repository instance.
25
     *
26
     * @var ThreadRepositoryInterface
27
     */
28
    protected $threadRepository;
29
30
    /**
31
     * How many items we show per page
32
     *
33
     * @var integer
34
     */
35
    protected $itemsPerPage;
36
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)
42
    {
43
        $this->threadRepository = $threadRepository;
44
        $this->itemsPerPage = $itemsPerPage;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getOutboxThreadsPagerfanta(ParticipantInterface $participant, $currentPage)
51
    {
52
        $queryBuilder = $this->threadRepository->getOutboxThreadsForParticipantQueryBuilder($participant);
53
54
        return $this->getPagerfantaObject($queryBuilder, $currentPage, $this->itemsPerPage);
55
    }
56
}
57