src/Grant/AbstractGrant.php
protected function generateUniqueIdentifier($length = 40)
    {
        try {
            return bin2hex(random_bytes($length));
            // @codeCoverageIgnoreStart
        } catch (TypeError $e) {
            throw OAuthServerException::serverError('An unexpected error has occurred', $e);
        } catch (Error $e) {
            throw OAuthServerException::serverError('An unexpected error has occurred', $e);
        } catch (Exception $e) {
            // If you get this message, the CSPRNG failed hard.
            throw OAuthServerException::serverError('Could not generate a random string', $e);
        }
        // @codeCoverageIgnoreEnd
    }
protected function generateUniqueIdentifier($length = 40)
    {
        try {
            return bin2hex(random_bytes($length));
            // @codeCoverageIgnoreStart
        } catch (TypeError $e) {
            throw OAuthServerException::serverError('An unexpected error has occurred', $e);
        } catch (Error $e) {
            throw OAuthServerException::serverError('An unexpected error has occurred', $e);
        } catch (Exception $e) {
            // If you get this message, the CSPRNG failed hard.
            throw OAuthServerException::serverError('Could not generate a random string', $e);
        }
        // @codeCoverageIgnoreEnd
    }
protected function generateUniqueIdentifier ( $ length = 40 ) { try { return bin2hex ( random_bytes ( $ length ) ) ; // @codeCoverageIgnoreStart } catch ( TypeError $ e ) { throw OAuthServerException :: serverError ( 'An unexpected error has occurred' , $ e ) ; } catch ( Error $ e ) { throw OAuthServerException :: serverError ( 'An unexpected error has occurred' , $ e ) ; } catch ( Exception $ e ) { // If you get this message, the CSPRNG failed hard. throw OAuthServerException :: serverError ( 'Could not generate a random string' , $ e ) ; } // @codeCoverageIgnoreEnd }
Generate a new unique identifier.

@param int $length

@throws OAuthServerException

@return string
Generate a new unique identifier .