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

Str   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A contains() 0 10 4
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