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

DefaultController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 12 1
A sqslistAction() 0 15 1
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
}