@@ -59,62 +59,6 @@ class HtmlArray extends RendererAbstract
59
59
'title_b ' => 'New Version ' ,
60
60
);
61
61
62
- /**
63
- * From https://gist.github.com/stemar/8287074
64
- * @param string $string The input string.
65
- * @param string $replacement The replacement string.
66
- * @param int $start If start is positive, the replacing will begin at the start'th offset into string.
67
- * If start is negative, the replacing will begin at the start'th character from the end of string.
68
- * @param int|null $length If given and is positive, it represents the length of the portion of string which is to
69
- * be replaced. If it is negative, it represents the number of characters from the end of string at which to
70
- * stop replacing. If it is not given, then it will default to strlen( string ); i.e. end the replacing at the
71
- * end of string. Of course, if length is zero then this function will have the effect of inserting replacement
72
- * into string at the given start offset.
73
- * @return string|array The result string is returned. If string is an array then array is returned.
74
- */
75
- public function mbSubstrReplace (string $ string , string $ replacement , int $ start , $ length = null )
76
- {
77
- if (is_array ($ string )) {
78
- $ num = count ($ string );
79
- // $replacement
80
- if (is_array ($ replacement )) {
81
- $ replacement = array_slice ($ replacement , 0 , $ num );
82
- } else {
83
- $ replacement = array_pad (array ($ replacement ), $ num , $ replacement );
84
- }
85
-
86
- // $start
87
- if (is_array ($ start )) {
88
- $ start = array_slice ($ start , 0 , $ num );
89
- foreach ($ start as $ key => $ value ) {
90
- $ start [$ key ] = is_int ($ value ) ? $ value : 0 ;
91
- }
92
- } else {
93
- $ start = array_pad (array ($ start ), $ num , $ start );
94
- }
95
- // $length
96
- if (!isset ($ length )) {
97
- $ length = array_fill (0 , $ num , 0 );
98
- } elseif (is_array ($ length )) {
99
- $ length = array_slice ($ length , 0 , $ num );
100
- foreach ($ length as $ key => $ value ) {
101
- $ length [$ key ] = isset ($ value ) ? (is_int ($ value ) ? $ value : $ num ) : 0 ;
102
- }
103
- } else {
104
- $ length = array_pad (array ($ length ), $ num , $ length );
105
- }
106
- // Recursive call
107
- return array_map (array ($ this , 'mbSubstrReplace ' ), $ string , $ replacement , $ start , $ length );
108
- }
109
- preg_match_all ('/./us ' , (string )$ string , $ smatches );
110
- preg_match_all ('/./us ' , (string )$ replacement , $ rmatches );
111
- if ($ length === null ) {
112
- $ length = mb_strlen ($ string );
113
- }
114
- array_splice ($ smatches ['0 ' ], $ start , $ length , $ rmatches [0 ]);
115
- return join ($ smatches ['0 ' ]);
116
- }
117
-
118
62
/**
119
63
* @param string|array $changes
120
64
* @param SideBySide|Inline $object
0 commit comments