Code Duplication    Length = 14-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 531-544 (lines=14) @@
528
   *
529
   * @return bool  <p>Whether or not $str starts with $substring.</p>
530
   */
531
  public function startsWithAny(array $substrings, bool $caseSensitive = true): bool
532
  {
533
    if (empty($substrings)) {
534
      return false;
535
    }
536
537
    foreach ($substrings as $substring) {
538
      if ($this->startsWith($substring, $caseSensitive)) {
539
        return true;
540
      }
541
    }
542
543
    return false;
544
  }
545
546
  /**
547
   * Ensures that the string ends with $substring. If it doesn't, it's appended.
@@ 604-617 (lines=14) @@
601
   *
602
   * @return bool     <p>Whether or not $str ends with $substring.</p>
603
   */
604
  public function endsWithAny(array $substrings, bool $caseSensitive = true): bool
605
  {
606
    if (empty($substrings)) {
607
      return false;
608
    }
609
610
    foreach ($substrings as $substring) {
611
      if ($this->endsWith($substring, $caseSensitive)) {
612
        return true;
613
      }
614
    }
615
616
    return false;
617
  }
618
619
  /**
620
   * Returns the first $n characters of the string.