Code Duplication    Length = 8-11 lines in 2 locations

src/Stringy.php 2 locations

@@ 1595-1605 (lines=11) @@
1592
                ),
1593
                $trimChars
1594
            );
1595
      } else {
1596
        $extract = $ellipsis . trim(
1597
                UTF8::substr(
1598
                    $text,
1599
                    $pos_start,
1600
                    $pos_end,
1601
                    $this->encoding
1602
                ),
1603
                $trimChars
1604
            ) . $ellipsis;
1605
      }
1606
1607
    } else {
1608
@@ 1621-1628 (lines=8) @@
1618
          UTF8::strpos($text, '.', $l, $this->encoding)
1619
      );
1620
1621
      if ($pos_end) {
1622
        $extract = rtrim(
1623
                       UTF8::substr($text, 0, $pos_end, $this->encoding),
1624
                       $trimChars
1625
                   ) . $ellipsis;
1626
      } else {
1627
        $extract = $text;
1628
      }
1629
    }
1630
1631
    return static::create($extract, $this->encoding);