Passed
Push — master ( b81e61...edaa23 )
by Radu
01:29
created

Strings::startsWith()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.2
c 0
b 0
f 0
cc 4
eloc 5
nc 4
nop 3
1
<?php
2
namespace WebServCo\Framework\Utils;
3
4
final class Strings
5
{
6
    public static function startsWith($haystack, $needle, $ignoreCase = true)
7
    {
8
        if (false !== $ignoreCase) {
9
            $function = function_exists('mb_stripos') ? 'mb_stripos' : 'stripos';
10
        } else {
11
            $function = function_exists('mb_strpos') ? 'mb_strpos' : 'strpos';
12
        }
13
14
        return 0 === $function($haystack, $needle);
15
    }
16
}
17