Passed
Push — master ( 2955c9...ee5866 )
by Fran
05:26
created

LogController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
ccs 0
cts 19
cp 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A logs() 0 11 1
A showLogs() 0 13 1
1
<?php
2
namespace PSFS\controller;
3
4
use PSFS\controller\base\Admin;
5
6
/**
7
 * Class LogController
8
 * @package PSFS\controller
9
 */
10
class LogController extends Admin
11
{
12
    /**
13
     * Servicio que muestra los logs del sistema
14
     * @GET
15
     * @route /admin/logs
16
     * @visible false
17
     * @return string|null
18
     */
19
    public function logs()
20
    {
21
        $log = _("Selecciona un fichero de log");
22
        $logs = $this->srv->getLogFiles();
23
24
        asort($logs);
25
        return $this->render("logs.html.twig", array(
26
            "logs" => $logs,
27
            "log" => $log,
28
        ));
29
    }
30
31
    /**
32
     * @POST
33
     * @route /admin/logs
34
     * @visible false
35
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
36
     */
37
    public function showLogs()
38
    {
39
        $logs = $this->srv->getLogFiles();
40
        $selected = $this->getRequest()->get("log");
41
        list($log, $monthOpen) = $this->srv->formatLogFile($selected);
42
        asort($logs);
43
        return $this->render("logs.html.twig", array(
44
            "logs" => $logs,
45
            "log" => $log,
46
            "selected" => $selected,
47
            "month_open" => $monthOpen,
48
        ));
49
    }
50
}