Completed
Push — master ( 9fac8c...4a6074 )
by Ryota
04:37
created

DefaultController::sqslistAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: polidog
5
 * Date: 2016/03/14
6
 */
7
8
namespace Tavii\SQSJobQueueBundle\Controller;
9
10
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
11
use Tavii\SQSJobQueueBundle\Storage\DoctrineStorage;
12
13
/**
14
 * Class DefaultController
15
 */
16
class DefaultController extends Controller
17
{
18
    /**
19
     * @return \Symfony\Component\HttpFoundation\Response
20
     */
21
    public function indexAction()
22
    {
23
        /** @var DoctrineStorage $storage */
24
        $storage = $this->get('sqs_job_queue.storage.doctrine');
25
26
        /** @var array $workers */
27
        $workers = $storage->all();
28
29
        return $this->render('TaviiSQSJobQueueBundle:Default:index.html.twig', [
30
            'workers' => $workers
31
        ]);
32
    }
33
34
    /**
35
     * @return \Symfony\Component\HttpFoundation\Response
36
     */
37
    public function sqslistAction()
38
    {
39
        $prefix = $this->getParameter('sqs_job_queue.prefix');
40
        $client = $this->get('sqs_job_queue.client');
41
        $results = $client->listQueues(array(
42
            'QueueNamePrefix' => $prefix,
43
        ));
44
45
        return $this->render('TaviiSQSJobQueueBundle:Default:sqslist.html.twig', [
46
            'queueUrls' => $results['QueueUrls'],
47
            'prefix' => $prefix
48
        ]);
49
50
51
    }
52
}