Request::get()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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