Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

@@ 459-468 (lines=10) @@
456
   *
457
   * @return Stringy Object with its $str prefixed by the $substring
458
   */
459
  public function ensureLeft($substring)
460
  {
461
    $stringy = static::create($this->str, $this->encoding);
462
463
    if (!$stringy->startsWith($substring)) {
464
      $stringy->str = $substring . $stringy->str;
465
    }
466
467
    return $stringy;
468
  }
469
470
  /**
471
   * Returns true if the string begins with $substring, false otherwise. By
@@ 500-509 (lines=10) @@
497
   *
498
   * @return Stringy Object with its $str suffixed by the $substring
499
   */
500
  public function ensureRight($substring)
501
  {
502
    $stringy = static::create($this->str, $this->encoding);
503
504
    if (!$stringy->endsWith($substring)) {
505
      $stringy->str .= $substring;
506
    }
507
508
    return $stringy;
509
  }
510
511
  /**
512
   * Returns true if the string ends with $substring, false otherwise. By