Request   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 35
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 2 2
A hasPost() 0 2 1
A hasGet() 0 2 1
A post() 0 2 2
1
<?php
2
3
/**
4
 * Request
5
 * Clase para gestionar los Requests POST y GET
6
 * @author nelson rojas
7
 */
8
class Request {
9
    /**
10
     * Obtiene el contenido de $_POST[$var]
11
     * @param string $var
12
     * @return mixed|null
13
     */
14
    public static function post(string $var) {
15
        return filter_has_var(INPUT_POST, $var) ? $_POST[$var] : NULL;
16
    }
17
18
    /**
19
     * Permite saber si $var está contenido dentro de $_POST
20
     * @param string $var
21
     * @return bool
22
     */
23
    public static function hasPost(string $var):bool {
24
        return filter_has_var(INPUT_POST, $var);
25
    }
26
27
    /**
28
     * Obtiene el contenido de $var dentro de $_GET[$var]
29
     * @param string $var
30
     * @return mixed|null
31
     */
32
    public static function get(string $var) {
33
        return filter_has_var(INPUT_GET, $var) ? $_GET[$var] : NULL;
34
    }
35
36
    /**
37
     * Permite saber si existe $var dentro de $_GET
38
     * @param string $var
39
     * @return bool
40
     */
41
    public static function hasGet(string $var):bool {
42
        return filter_has_var(INPUT_GET, $var);
43
    }
44
45
}
46