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
@@ 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