Test Failed
Push — master ( 614e1a...5c1cf2 )
by gt9000
13:11
created

Str::contains()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 5
nc 3
nop 2
dl 0
loc 10
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
namespace zqhong\route\Helpers;
4
5
class Str
6
{
7
    /**
8
     * Determine if a given string contains a given substring.
9
     *
10
     * @param  string $haystack
11
     * @param  string|array $needles
12
     * @return bool
13
     */
14
    public static function contains($haystack, $needles)
15
    {
16
        foreach ((array)$needles as $needle) {
17
            if ($needle != '' && mb_strpos($haystack, $needle) !== false) {
18
                return true;
19
            }
20
        }
21
22
        return false;
23
    }
24
}
25