GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — 3.0 ( c3085b...827fa4 )
by Vermeulen
02:56
created

Datas   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 11
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 57
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
D checkType() 0 34 10
A checkMail() 0 4 1
1
<?php
2
3
namespace BFW\Helpers;
4
5
/**
6
 * Helpers to manage datas
7
 */
8
class Datas
9
{
10
    /**
11
     * Check types of variables
12
     * 
13
     * @param array $vars : Variables to check
14
     *  array(array('type' => 'monType', 'data' => 'mesData), array(...)...)
15
     * 
16
     * @return boolean
17
     */
18
    public static function checkType($vars)
19
    {
20
        if (!is_array($vars)) {
21
            return false;
22
        }
23
24
        foreach ($vars as $var) {
25
            if (!is_array($var)) {
26
                return false;
27
            }
28
29
            if (!(!empty($var['type']) && isset($var['data']))) {
30
                return false;
31
            }
32
33
            if (!is_string($var['type'])) {
34
                return false;
35
            }
36
37
            if ($var['type'] === 'int') {
38
                $var['type'] = 'integer';
39
            }
40
41
            if ($var['type'] === 'float') {
42
                $var['type'] = 'double';
43
            }
44
45
            if (gettype($var['data']) !== $var['type']) {
46
                return false;
47
            }
48
        }
49
50
        return true;
51
    }
52
53
    /**
54
     * Check if an email address is valid
55
     * 
56
     * @param string $mail The email address to check
57
     * 
58
     * @return boolean
59
     */
60
    public static function checkMail($mail)
61
    {
62
        return Secure::securise($mail, 'email');
0 ignored issues
show
Bug introduced by
The call to securise() misses a required argument $htmlentities.

This check looks for function calls that miss required arguments.

Loading history...
63
    }
64
}
65