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.
Test Failed
Push — master ( 9876ba...31eef1 )
by Jackson
15:15
created

Stringy::endsWith()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace AlibabaCloud\Client\Support;
4
5
/**
6
 * Class Stringy
7
 *
8
 * @package AlibabaCloud\Client\Support
9
 */
10
class Stringy
11
{
12
13
    private static function _value($value, $default = '')
14
    {
15
        return null === $value ? $default : $value;
16
    }
17
18
    /**
19
     * @param string $str
20
     * @param string $substr
21
     *
22
     * @return bool
23
     */
24
    public static function contains($str, $substr)
25
    {
26
        return false !== strpos(self::_value($str), self::_value($substr));
27
    }
28
29
    /**
30
     * @param string $str
31
     * @param string $substr
32
     *
33
     * @return bool
34
     */
35
    public static function endsWith($str, $substr)
36
    {
37
        $str      = self::_value($str);
38
        $substr = self::_value($substr);
39
        $length = \strlen($substr);
40
        if (!$length) {
41
            return true;
42
        }
43
44
        return substr($str, -$length) === $substr;
45
    }
46
47
}
48