Completed
Push — master ( 5a5b2e...66ec7e )
by Matze
04:12
created

Swagger   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A dump() 0 11 1
1
<?php
2
3
namespace BrainExe\Core\Index;
4
5
use BrainExe\Core\Annotations\Controller as ControllerAnnotation;
6
use BrainExe\Core\Annotations\Guest;
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("Core.Index.Swagger")
15
 */
16
class Swagger
17
{
18
19
    use EventDispatcherTrait;
20
21
    /**
22
     * @return Response
23
     * @Route("/swagger.yml", name="swagger", methods="GET")
24
     */
25
    public function dump() : Response
26
    {
27
        $output = new BufferedOutput();
28
        $event  = new ConsoleEvent('swagger:dump', $output);
29
30
        $this->dispatchEvent($event);
31
32
        return new Response($output->fetch(), 200, [
33
            'Content-Type' => 'text/x-yaml'
34
        ]);
35
    }
36
}
37