Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

@@ 1329-1338 (lines=10) @@
1326
   *
1327
   * @return Stringy Object with the resulting $str after the replacements
1328
   */
1329
  public function replace($search, $replacement, $caseSensitive = true)
1330
  {
1331
    if ($caseSensitive) {
1332
      $return = UTF8::str_replace($search, $replacement, $this->str);
1333
    } else {
1334
      $return = UTF8::str_ireplace($search, $replacement, $this->str);
1335
    }
1336
1337
    return static::create($return);
1338
  }
1339
1340
  /**
1341
   * Replaces all occurrences of $search in $str by $replacement.
@@ 1349-1358 (lines=10) @@
1346
   *
1347
   * @return Stringy Object with the resulting $str after the replacements
1348
   */
1349
  public function replaceAll(array $search, $replacement, $caseSensitive = true)
1350
  {
1351
    if ($caseSensitive) {
1352
      $return = UTF8::str_replace($search, $replacement, $this->str);
1353
    } else {
1354
      $return = UTF8::str_ireplace($search, $replacement, $this->str);
1355
    }
1356
1357
    return static::create($return);
1358
  }
1359
1360
  /**
1361
   * Replaces all occurrences of $search from the beginning of string with $replacement