| Conditions | 3 |
| Paths | 4 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 64 | public function tokenize( $string ) { |
||
| 65 | |||
| 66 | if ( $this->tokenizer !== null ) { |
||
| 67 | $string = implode( " ", $this->tokenizer->tokenize( $string ) ); |
||
| 68 | } |
||
| 69 | |||
| 70 | // (?<=\p{L})(?=\p{N}) to split alphanumeric and numeric |
||
| 71 | |||
| 72 | $pattern = str_replace( |
||
| 73 | $this->patternExemption, |
||
| 74 | '', |
||
| 75 | '([\s\-_,:;?!%\'\|\/\(\)\[\]{}<>\r\n"]|(?<!\d)\.(?!\d)|(?<=\p{L})(?=\p{N}))' |
||
| 76 | ); |
||
| 77 | |||
| 78 | $result = preg_split( '/' . $pattern . '/u', $string, null, PREG_SPLIT_NO_EMPTY ); |
||
| 79 | |||
| 80 | if ( $result === false ) { |
||
| 81 | $result = array(); |
||
| 82 | } |
||
| 83 | |||
| 84 | return $result; |
||
| 85 | } |
||
| 86 | |||
| 88 |