Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

@@ 488-497 (lines=10) @@
485
   *
486
   * @return static <p>Object with its $str prefixed by the $substring.</p>
487
   */
488
  public function ensureLeft(string $substring): self
489
  {
490
    $stringy = static::create($this->str, $this->encoding);
491
492
    if (!$stringy->startsWith($substring)) {
493
      $stringy->str = $substring . $stringy->str;
494
    }
495
496
    return $stringy;
497
  }
498
499
  /**
500
   * Returns true if the string begins with $substring, false otherwise. By
@@ 553-562 (lines=10) @@
550
   *
551
   * @return static <p>Object with its $str suffixed by the $substring.</p>
552
   */
553
  public function ensureRight(string $substring): self
554
  {
555
    $stringy = static::create($this->str, $this->encoding);
556
557
    if (!$stringy->endsWith($substring)) {
558
      $stringy->str .= $substring;
559
    }
560
561
    return $stringy;
562
  }
563
564
  /**
565
   * Returns true if the string ends with $substring, false otherwise. By