OutboxController::showAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 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\MessagingBundle\Controller;
12
13
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
14
use Miliooo\Messaging\ThreadProvider\Folder\OutboxProviderPagerFantaInterface;
15
use Miliooo\Messaging\User\ParticipantProviderInterface;
16
use Symfony\Component\HttpFoundation\Response;
17
18
/**
19
 * The outbox controller is responsible for showing outbox threads for the logged in user.
20
 *
21
 * @author Michiel Boeckaert <[email protected]>
22
 */
23
class OutboxController
24
{
25
    protected $templating;
26
    protected $outboxProvider;
27
    protected $participantProvider;
28
29
    /**
30
     * Constructor.
31
     *
32
     * @param EngineInterface                   $templating
33
     * @param OutboxProviderPagerFantaInterface $outboxProvider
34
     * @param ParticipantProviderInterface      $participantProvider
35
     */
36
    public function __construct(
37
        EngineInterface $templating,
38
        OutboxProviderPagerFantaInterface $outboxProvider,
39
        ParticipantProviderInterface $participantProvider
40
    ) {
41
        $this->templating = $templating;
42
        $this->outboxProvider = $outboxProvider;
43
        $this->participantProvider = $participantProvider;
44
    }
45
46
    /**
47
     * Shows the outbox threads for the logged in user
48
     *
49
     * @param integer $page The page we are on
50
     *
51
     * @return Response
52
     */
53
    public function showAction($page)
54
    {
55
        $loggedInUser = $this->participantProvider->getAuthenticatedParticipant();
56
        $pagerfanta = $this->outboxProvider->getOutboxThreadsPagerfanta($loggedInUser, $page);
57
        $view = 'MilioooMessagingBundle:Folders:outbox.html.twig';
58
59
        return $this->templating->renderResponse($view, ['pagerfanta' => $pagerfanta]);
60
    }
61
}
62