Code Duplication    Length = 8-11 lines in 2 locations

src/Stringy.php 2 locations

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