Completed
Pull Request — master (#9)
by Roman
03:36
created

GetReflectionFromRequestStep::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Kami\ApiCoreBundle\RequestProcessor\Step\Common;
4
5
use Kami\ApiCoreBundle\RequestProcessor\ProcessorResponse;
6
use Kami\ApiCoreBundle\RequestProcessor\Step\AbstractStep;
7
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
8
9
10
class GetReflectionFromRequestStep extends AbstractStep
11
{
12
13
    /**
14
     * @throws NotFoundHttpException
15
     * @return ProcessorResponse|\Kami\ApiCoreBundle\RequestProcessor\ResponseInterface
16
     */
17
    public function execute()
18
    {
19
        try {
20
            return $this->createResponse(
21
                ['reflection' => new \ReflectionClass($this->request->attributes->get('_entity'))]
22
            );
23
24
        } catch (\ReflectionException $e) {
25
            throw new NotFoundHttpException();
26
        }
27
    }
28
29
    /**
30
     * @return array
31
     */
32
    public function requiresBefore()
33
    {
34
        return [];
35
    }
36
}