Completed
Push — master ( 9feb36...7cf6be )
by Iakov
03:45
created

SerializeResponseDataStep::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 1
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Kami\ApiCoreBundle\RequestProcessor\Step\Common;
4
5
use JMS\Serializer\Serializer;
6
use Kami\ApiCoreBundle\RequestProcessor\ProcessorResponse;
7
use Kami\ApiCoreBundle\RequestProcessor\Step\AbstractStep;
8
9
class SerializeResponseDataStep extends AbstractStep
10
{
11 1
    public function execute()
12
    {
13 1
        $serializer = $this->getFromResponse('serializer');
14
15 1
        $serialized = $serializer->serialize(
16 1
            $this->getFromResponse('response_data'),
17 1
            $this->request->attributes->get('_format')
18
        );
19 1
        return $this->createResponse(['response_data'=> $serialized], true);
20
21
22
    }
23
24 1
    public function requiresBefore()
25
    {
26 1
        return [BuildSerializerStep::class];
27
    }
28
}