WP_Text_Diff_Renderer_inline   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A _splitOnWords() 0 6 1
1
<?php
2
/**
3
 * Diff API: WP_Text_Diff_Renderer_inline class
4
 *
5
 * @package WordPress
6
 * @subpackage Diff
7
 * @since 4.7.0
8
 */
9
10
/**
11
 * Better word splitting than the PEAR package provides.
12
 *
13
 * @since 2.6.0
14
 * @uses Text_Diff_Renderer_inline Extends
15
 */
16
class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline {
17
18
	/**
19
	 * @ignore
20
	 * @since 2.6.0
21
	 *
22
	 * @param string $string
23
	 * @param string $newlineEscape
24
	 * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string[]?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
25
	 */
26
	public function _splitOnWords($string, $newlineEscape = "\n") {
27
		$string = str_replace("\0", '', $string);
28
		$words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
29
		$words  = str_replace( "\n", $newlineEscape, $words );
30
		return $words;
31
	}
32
33
}
34