Passed
Push — master ( ddbf8b...086098 )
by Robbie
11:17
created

UrlPathStartswithCaseInsensitive::checkPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Control\Middleware\ConfirmationMiddleware;
4
5
use SilverStripe\Control\HTTPRequest;
6
use SilverStripe\Security\Confirmation;
7
8
/**
9
 * A case insensitive rule to match beginning of URL
10
 */
11
class UrlPathStartswithCaseInsensitive extends UrlPathStartswith
12
{
13
    protected function checkPath($path)
14
    {
15
        $pattern = $this->getPath();
16
17
        $mb_path = mb_strcut($this->normalisePath($path), 0, strlen($pattern));
18
        return mb_stripos($mb_path, $pattern) === 0;
19
    }
20
}
21