@@ 202-227 (lines=26) @@ | ||
199 | * @return $this |
|
200 | * @throws Exception\RuntimeException |
|
201 | */ |
|
202 | public function removeNotReplacedChar($notReplaced) |
|
203 | { |
|
204 | if (empty($notReplaced)) { |
|
205 | throw new Exception\RuntimeException('Not replaced character cannot be null.'); |
|
206 | } |
|
207 | ||
208 | if (is_array($notReplaced)) { |
|
209 | foreach ($notReplaced as $n) { |
|
210 | $this->removeNotReplacedChar($n); |
|
211 | } |
|
212 | } else { |
|
213 | if (!in_array($notReplaced, $this->getNotReplacedChars())) { |
|
214 | throw new Exception\RuntimeException("Not replaced character '$notReplaced' is not in array."); |
|
215 | } |
|
216 | ||
217 | $notReplacedChars = []; |
|
218 | foreach ($this->notReplacedChars as $n) { |
|
219 | if ($n != $notReplaced) { |
|
220 | $notReplacedChars[] = $n; |
|
221 | } |
|
222 | $this->notReplacedChars = $notReplacedChars; |
|
223 | } |
|
224 | } |
|
225 | ||
226 | return $this; |
|
227 | } |
|
228 | ||
229 | /** |
|
230 | * Returns the delimiterReplacement option |
|
@@ 294-319 (lines=26) @@ | ||
291 | * @return $this |
|
292 | * @throws Exception\RuntimeException |
|
293 | */ |
|
294 | public function removeWordDelimiter($delimiters) |
|
295 | { |
|
296 | if (empty($delimiters)) { |
|
297 | throw new Exception\RuntimeException('Word delimiter cannot be null.'); |
|
298 | } |
|
299 | ||
300 | if (is_array($delimiters)) { |
|
301 | foreach ($delimiters as $delimiter) { |
|
302 | $this->removeWordDelimiter($delimiter); |
|
303 | } |
|
304 | } else { |
|
305 | if (!in_array($delimiters, $this->getWordDelimiters())) { |
|
306 | throw new Exception\RuntimeException("Word delimiter '$delimiters' is not in delimiters array."); |
|
307 | } |
|
308 | ||
309 | $wordDelimiters = []; |
|
310 | foreach ($this->wordDelimiters as $delimiter) { |
|
311 | if ($delimiter != $delimiters) { |
|
312 | $wordDelimiters[] = $delimiter; |
|
313 | } |
|
314 | $this->wordDelimiters = $wordDelimiters; |
|
315 | } |
|
316 | } |
|
317 | ||
318 | return $this; |
|
319 | } |
|
320 | ||
321 | /** |
|
322 | * Replace delimiters with another string |