DefaultController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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