Completed
Push — master ( 256c3c...d8e20a )
by Karsten
01:47
created

StartingWith::match()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * Created by gerk on 29.11.17 07:01
4
 */
5
6
namespace PeekAndPoke\Component\Psi\Psi\Str;
7
8
/**
9
 *
10
 *
11
 * @author Karsten J. Gerber <[email protected]>
12
 */
13
class StartingWith extends AbstractStringMatch
14
{
15
    /**
16
     * @param string $needle
17
     * @param string $haystack
18
     *
19
     * @return bool
20
     */
21 33
    public function match($needle, $haystack)
22
    {
23
        /** @noinspection SubStrUsedAsStrPosInspection */
24 33
        return substr($haystack, 0, strlen($needle)) === $needle;
25
    }
26
}
27