| @@ 166-183 (lines=18) @@ | ||
| 163 | * @return $this |
|
| 164 | * @throws Exception\RuntimeException |
|
| 165 | */ |
|
| 166 | public function addNotReplacedChars($notReplaced) |
|
| 167 | { |
|
| 168 | if (in_array($notReplaced, $this->getNotReplacedChars())) { |
|
| 169 | throw new Exception\RuntimeException("Not replaced characterr '$notReplaced' is already there."); |
|
| 170 | } |
|
| 171 | ||
| 172 | if (empty($notReplaced)) { |
|
| 173 | throw new Exception\RuntimeException('Not replaced character cannot be null.'); |
|
| 174 | } |
|
| 175 | ||
| 176 | if (is_array($notReplaced)) { |
|
| 177 | $this->notReplacedChars = array_merge($this->getNotReplacedChars(), $notReplaced); |
|
| 178 | } else { |
|
| 179 | $this->notReplacedChars[] = $notReplaced; |
|
| 180 | } |
|
| 181 | ||
| 182 | return $this; |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * Returns chars which are not replaced |
|
| @@ 268-285 (lines=18) @@ | ||
| 265 | * @return $this |
|
| 266 | * @throws Exception\RuntimeException |
|
| 267 | */ |
|
| 268 | public function addWordDelimiter($delimiter) |
|
| 269 | { |
|
| 270 | if (in_array($delimiter, $this->getWordDelimiters())) { |
|
| 271 | throw new Exception\RuntimeException("Word delimiter '$delimiter' is already there."); |
|
| 272 | } |
|
| 273 | ||
| 274 | if (empty($delimiter)) { |
|
| 275 | throw new Exception\RuntimeException('Word delimiter cannot be null.'); |
|
| 276 | } |
|
| 277 | ||
| 278 | if (is_array($delimiter)) { |
|
| 279 | $this->wordDelimiters = array_merge($this->getWordDelimiters(), $delimiter); |
|
| 280 | } else { |
|
| 281 | $this->wordDelimiters[] = $delimiter; |
|
| 282 | } |
|
| 283 | ||
| 284 | return $this; |
|
| 285 | } |
|
| 286 | ||
| 287 | /** |
|
| 288 | * Remove word delimiter |
|