public function generate()
    {
        $pickChars = str_repeat(static::DICTIONARY, static::LENGTH);
        for (; ;) {
            $value = substr(str_shuffle($pickChars), 0, static::LENGTH);
            if (preg_match(static::TOKEN_GENERATION_REGEX, $value)) {
                $this->insertQuery->execute([$value]);
                if ($this->insertQuery->rowCount() === 1) {
                    break;
                }
            }
        }

        return $value;
    }
public function generate()
    {
        $pickChars = str_repeat(static::DICTIONARY, static::LENGTH);
        for (; ;) {
            $value = substr(str_shuffle($pickChars), 0, static::LENGTH);
            if (preg_match(static::TOKEN_GENERATION_REGEX, $value)) {
                $this->insertQuery->execute([$value]);
                if ($this->insertQuery->rowCount() === 1) {
                    break;
                }
            }
        }

        return $value;
    }
public function generate ( ) { $ pickChars = str_repeat ( static :: DICTIONARY , static :: LENGTH ) ; for ( ; ; ) { $ value = substr ( str_shuffle ( $ pickChars ) , 0 , static :: LENGTH ) ; if ( preg_match ( static :: TOKEN_GENERATION_REGEX , $ value ) ) { $ this -> insertQuery -> execute ( [ $ value ] ) ; if ( $ this -> insertQuery -> rowCount ( ) === 1 ) { break ; } } } return $ value ; }
Generate a new API token.

@return string
Generate a new API token .