Completed
Push — master ( 1b12be...a9625e )
by Karsten
02:00
created

IsEndingWith   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A match() 0 6 2
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 IsEndingWith extends AbstractStringMatch
14
{
15
    /**
16
     * @param string $needle
17
     * @param string $haystack
18
     *
19
     * @return bool
20
     */
21 40
    public function match($needle, $haystack)
22
    {
23 40
        $len = strlen($needle);
24
25 40
        return $len === 0 || substr($haystack, -$len) === $needle;
26
    }
27
}
28