OutboxProviderPagerFanta   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getOutboxThreadsPagerfanta() 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
 * 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