Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
35 | protected static function getIdentifierForUrl($url) |
||
36 | { |
||
37 | $identifier = null; |
||
38 | |||
39 | foreach (config('apps.url') as $id => $root) { |
||
40 | $root = preg_replace('#^https?://#', '', $root); |
||
41 | $pattern = '#^https?://'.preg_quote($root, '#').'([\?/].*)?$#'; |
||
42 | if (preg_match($pattern, $url)) { |
||
43 | $len = strlen($root); |
||
44 | if (! isset($length) || $length < $len) { |
||
45 | $length = $len; |
||
46 | $identifier = $id; |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | return $identifier; |
||
52 | } |
||
64 |