MAKS\AmqpAgent\Helper\IDGenerator::generateToken
Generates a crypto safe unique token. Note that this function is pretty expensive.
Signature
public function generateToken([integer
$length = 32,
[string
$charset = NULL,
[string
$hashing = NULL]]] )
Parameters
$length
—
integer
- The length of the token. If the token is hashed this will not be the length of the returned string.
$charset
—
string
- [optional] A string of characters to generate the token from. Defaults to alphanumeric.
$hashing
—
string
- [optional] A name of hashing algorithm to hash the generated token with. Defaults to no hashing.
Returns
- string
Test Coverage
Information
- Coverage: 9/9 Lines (100%)
- Tests: 2
- Passed: 2 (100%)
Tests
- [ PASSED ] — MAKS\AmqpAgent\Tests\Helper\IDGeneratorTest::testGenerateTokenGeneratesUniqueTokens
- [ PASSED ] — MAKS\AmqpAgent\Tests\Helper\IDGeneratorTest::testGenerateTokenWithAditionalParametersGeneratesUniqueTokens