| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | public function preConnect() |
||
| 12 | { |
||
| 13 | if (count($this->patterns)) return; |
||
| 14 | |||
| 15 | $ltrs = '\w'; |
||
| 16 | $gunk = '/\#~:.?+=&%@!\-\[\]'; |
||
| 17 | $punc = '.:?\-;,'; |
||
| 18 | $host = $ltrs.$punc; |
||
| 19 | $any = $ltrs.$gunk.$punc; |
||
| 20 | |||
| 21 | $this->schemes = getSchemes(); |
||
| 22 | foreach ($this->schemes as $scheme) { |
||
| 23 | $this->patterns[] = '\b(?i)'.$scheme.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; |
||
| 24 | } |
||
| 25 | |||
| 26 | $this->patterns[] = '(?<=\s)(?i)www?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; |
||
| 27 | $this->patterns[] = '(?<=\s)(?i)ftp?(?-i)\.['.$host.']+?\.['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; |
||
| 28 | } |
||
| 29 | |||
| 53 |