Code Duplication    Length = 8-11 lines in 2 locations

src/Stringy.php 2 locations

@@ 1641-1651 (lines=11) @@
1638
                ),
1639
                $trimChars
1640
            );
1641
      } else {
1642
        $extract = $ellipsis . trim(
1643
                UTF8::substr(
1644
                    $text,
1645
                    $pos_start,
1646
                    $pos_end,
1647
                    $this->encoding
1648
                ),
1649
                $trimChars
1650
            ) . $ellipsis;
1651
      }
1652
1653
    } else {
1654
@@ 1667-1674 (lines=8) @@
1664
          UTF8::strpos($text, '.', $l, $this->encoding)
1665
      );
1666
1667
      if ($pos_end) {
1668
        $extract = rtrim(
1669
                       UTF8::substr($text, 0, $pos_end, $this->encoding),
1670
                       $trimChars
1671
                   ) . $ellipsis;
1672
      } else {
1673
        $extract = $text;
1674
      }
1675
    }
1676
1677
    return static::create($extract, $this->encoding);