Code Duplication    Length = 10-10 lines in 2 locations

src/Stringy.php 2 locations

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