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

UrlPathStartswithCaseInsensitive   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkPath() 0 6 1
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