Swagger::dump()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
crap 1
1
<?php
2
3
namespace BrainExe\Core\Index;
4
5
use BrainExe\Core\Annotations\Controller as ControllerAnnotation;
6
7
use BrainExe\Core\Annotations\Route;
8
use BrainExe\Core\EventDispatcher\Events\ConsoleEvent;
9
use BrainExe\Core\Traits\EventDispatcherTrait;
10
use Symfony\Component\Console\Output\BufferedOutput;
11
use Symfony\Component\HttpFoundation\Response;
12
13
/**
14
 * @ControllerAnnotation
15
 */
16
class Swagger
17
{
18
19
    use EventDispatcherTrait;
20
21
    /**
22
     * @return Response
23
     * @Route("/swagger.yml", name="swagger", methods="GET")
24
     */
25 1
    public function dump() : Response
26
    {
27 1
        $output = new BufferedOutput();
28 1
        $event  = new ConsoleEvent('swagger:dump', $output);
29
30 1
        $this->dispatchEvent($event);
31
32 1
        return new Response($output->fetch(), 200, [
33 1
            'Content-Type' => 'text/x-yaml'
34
        ]);
35
    }
36
}
37