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   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 35
rs 10
c 1
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A _value() 0 3 2
A endsWith() 0 10 2
A contains() 0 3 1
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