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 — master ( 2e8805...dcc098 )
by Anderson
08:35
created

IndexHelper::indexIsValid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace DoctrineElastic\Helper;
4
5
/**
6
 * @author iuribrindeiro
7
 */
8
class IndexHelper {
9
10
    public static $invalidIndexCharacters = [' ', '"', '*', '/', '<', '|', ',', '>', '\\', '?', '\''];
11
    public static $scapedInvalidIndexCharacters = ['\s', '\"', '\*', '\/', '<', '\|', ',', '>', '\\\\', '\?', '\''];
12
13
    /**
14
     * @param string $index
15
     * @return string
16
     */
17
    public static function clearIndex(&$index) {
18
        $index = mb_strtolower(str_replace(' ', '', $index));
19
        return $index;
20
    }
21
22
    /**
23
     * @param string $index
24
     * @return bool
25
     */
26
    public static function indexIsValid($index) {
27
        if (empty($index)) {
28
            return false;
29
        }
30
31
        $pattern = '/(' . implode('|', self::$scapedInvalidIndexCharacters) . ')/';
32
33
        return !boolval(preg_match($pattern, $index));
34
    }
35
}
36