Completed
Push — master ( c458f8...eeebc2 )
by Matze
06:56
created

Controller   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A index() 0 6 1
A robotstxt() 0 8 1
1
<?php
2
3
namespace BrainExe\Core\Index;
4
5
use BrainExe\Annotations\Annotations\Inject;
6
use BrainExe\Core\Annotations\Controller as ControllerAnnotation;
7
use BrainExe\Core\Annotations\Guest;
8
use BrainExe\Core\Annotations\Route;
9
use Symfony\Component\HttpFoundation\Response;
10
11
/**
12
 * @ControllerAnnotation("Core.Index.Controller")
13
 */
14
class Controller
15
{
16
 
17
    /**
18
     * Deliver base HTML layout
19
     * @return Response
20
     * @Route("/", name="index", methods="GET")
21
     * @Guest
22
     */
23
    public function index() : Response
24
    {
25
        $response = file_get_contents(ROOT . '/web/index.html');
26
27
        return new Response($response);
28
    }
29
30
    /**
31
     * @return Response
32
     * @Route("/robots.txt", name="robots.txt")
33
     * @Guest
34
     */
35
    public function robotstxt() : Response
36
    {
37
        $response = new Response();
38
        $response->headers->set('Content-Type', 'text/plain');
39
        $response->setContent("User-agent: *\nDisallow: /");
40
41
        return $response;
42
    }
43
}
44