Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

@@ 461-470 (lines=10) @@
458
   *
459
   * @return Stringy Object with its $str prefixed by the $substring
460
   */
461
  public function ensureLeft($substring)
462
  {
463
    $stringy = static::create($this->str, $this->encoding);
464
465
    if (!$stringy->startsWith($substring)) {
466
      $stringy->str = $substring . $stringy->str;
467
    }
468
469
    return $stringy;
470
  }
471
472
  /**
473
   * Returns true if the string begins with $substring, false otherwise. By
@@ 502-511 (lines=10) @@
499
   *
500
   * @return Stringy Object with its $str suffixed by the $substring
501
   */
502
  public function ensureRight($substring)
503
  {
504
    $stringy = static::create($this->str, $this->encoding);
505
506
    if (!$stringy->endsWith($substring)) {
507
      $stringy->str .= $substring;
508
    }
509
510
    return $stringy;
511
  }
512
513
  /**
514
   * Returns true if the string ends with $substring, false otherwise. By