Closed thomasjthomasj closed 8 years ago
There are a couple of coding points in generateFromUnixRandom()
and generateFromOpenSSL()
. They are essentially the same code, so can they match as close as possible. There are also a couple of places that need breaklines (between if and where statements).
Use anon functions for different methods for hint reasons.
This PR makes some changes to the string generator:
setPattern()
and$_pattern
property as it is too difficult and inefficient (and at times impossible) to create a string that matches a regular expressionsetTenacity()
to determine how hard the string generator should try to make the string that matches the pattern and/or whitelist. This is the number of times it will attempt to create a string that matches a regex, and within that generation, how many times it will filter out characters that are not in the whitelist. This defaults to 1000, which means that if there was a very strict regex and very limited number of characters in the whitelist, it could potentially loop a million times, however, since the regex functionality is deprecated, you shouldn't be using both features in tandem anyway.allowChars()
method for developers to set which characters should be in the whitelist. This will override the current whitelistdisallowChars()
method for developers to remove characters from the whitelist.Exception\GenerateStringException
to be thrown when a string generation method has failed to create a string within the number of loops set by the tenacity/dev/arandom
before/dev/urandom
when generating a string usinggenerateFromUnixRandom()
Resolves https://github.com/mothership-ec/cog/issues/449