| Conditions | 3 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.0327 |
| Changes | 0 | ||
| 1 | <?php |
||
| 64 | 5 | public function tokenize( $string ) { |
|
| 65 | |||
| 66 | 5 | if ( $this->tokenizer !== null ) { |
|
| 67 | 1 | $string = implode( " ", $this->tokenizer->tokenize( $string ) ); |
|
| 68 | 1 | } |
|
| 69 | |||
| 70 | 5 | $pattern = str_replace( |
|
| 71 | 5 | $this->patternExemption, |
|
| 72 | 5 | '', |
|
| 73 | '_-・,、;:!?.。…◆★◇□■()【】《》〈〉;:“”"〃'`[]{}「」@*\/&#%`^+<=>|~≪≫─$"_\-・,、;:!?.。()[\]{}「」@*\/&#%`^+<=>|~«»$"\s' |
||
| 74 | 5 | ); |
|
| 75 | |||
| 76 | 5 | $result = preg_split( '/[' . $pattern . ']+/u', $string, null, PREG_SPLIT_NO_EMPTY ); |
|
| 77 | |||
| 78 | 5 | if ( $result === false ) { |
|
| 79 | $result = array(); |
||
| 80 | } |
||
| 81 | |||
| 82 | 5 | return $result; |
|
| 83 | } |
||
| 84 | |||
| 86 |