DefaultController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pongAction() 0 10 1
A indexAction() 0 3 1
1
<?php
2
3
namespace SmartboxSkeletonRemoteDemoBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use SmartboxSkeletonBundle\Entity\PingMessage;
7
use Symfony\Component\HttpFoundation\Response;
8
9
class DefaultController extends Controller
10
{
11
    public function indexAction()
12
    {
13
        return $this->render('SmartboxSkeletonRemoteDemoBundle:Default:index.html.twig');
14
    }
15
16
    public function pongAction()
17
    {
18
        $pingMessage = new PingMessage();
19
        $now = new \DateTime();
20
        $pingMessage->setTimestamp($now->getTimestamp());
21
        $pingMessage->setMessage('Pong');
22
        $serializer = $this->get('jms_serializer');
23
        $json = $serializer->serialize($pingMessage, 'json');
24
25
        return new Response($json, 200, array('Content-Type' => 'application/json'));
26
    }
27
}
28