Skip to content

Commit

Permalink
Merge pull request #15 from shatterproof/wordwrap
Browse files Browse the repository at this point in the history
Enhancement: Simplify `dashed` return
  • Loading branch information
valorin authored Jan 5, 2024
2 parents 914f0da + 0ef3c93 commit 0d42266
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function password(int $length = 16, bool $requireAll = false): string
}

/**
* Generate a random string of $length with lowercase and uppercase letters, and numbers, divided by $divider.
* Generate a random string of $length with lowercase and uppercase letters, and numbers, divided by $delimiter.
* This is suitable for use as a long random password that is easy to read and type.
*
* @param int $length
Expand All @@ -180,7 +180,7 @@ public function dashed(int $length = 25, string $delimiter = '-', int $chunkLeng
{
$string = $this->string($length, true, true, true, false, true);

return implode($delimiter, str_split($string, $chunkLength));
return wordwrap($string, $chunkLength, $delimiter, true);
}

/**
Expand Down

0 comments on commit 0d42266

Please sign in to comment.