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

Controller::robotstxt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
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