Str   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A startsWith() 0 10 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AcquiroPay;
6
7
class Str
8
{
9
    /**
10
     * Determine if a given string starts with a given substring.
11
     *
12
     * @param  string $haystack
13
     * @param  string|array $needles
14
     *
15
     * @return bool
16
     */
17
    public static function startsWith($haystack, $needles): bool
18
    {
19
        foreach ((array) $needles as $needle) {
20
            if ($needle !== '' && 0 === strpos($haystack, (string) $needle)) {
21
                return true;
22
            }
23
        }
24
25
        return false;
26
    }
27
}
28