Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

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