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 ( bb3aad...007a8f )
by Freek
03:06
created

helpers.php ➔ substr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\SslCertificate;
4
5
function starts_with($haystack, $needles): bool
6
{
7
    foreach ((array) $needles as $needle) {
8
        if ($needle != '' && mb_strpos($haystack, $needle) === 0) {
9
            return true;
10
        }
11
    }
12
13
    return false;
14
}
15
16
/**
17
 * Determine if a given string ends with a given substring.
18
 *
19
 * @param string       $haystack
20
 * @param string|array $needles
21
 *
22
 * @return bool
23
 */
24
function ends_with($haystack, $needles)
25
{
26
    foreach ((array) $needles as $needle) {
27
        if ((string) $needle === substr($haystack, -length($needle))) {
28
            return true;
29
        }
30
    }
31
32
    return false;
33
}
34
35
/**
36
 * Returns the portion of string specified by the start and length parameters.
37
 *
38
 * @param string   $string
39
 * @param int      $start
40
 * @param int|null $length
41
 *
42
 * @return string
43
 */
44
function substr($string, $start, $length = null)
45
{
46
    return mb_substr($string, $start, $length, 'UTF-8');
47
}
48
49
/**
50
 * Return the length of the given string.
51
 *
52
 * @param string $value
53
 *
54
 * @return int
55
 */
56
function length($value)
57
{
58
    return mb_strlen($value);
59
}
60