public function createToken(int $expire = 15): string
    {
        $token = uniqid(rand(), true);
        
        $saveInfos = (object) [
            'token' => $token,
            'date'  => new DateTime,
            'expire' => $expire
        ];

        $this->saveToken($saveInfos);
        return $saveInfos->token;
    }
public function createToken(int $expire = 15): string
    {
        $token = uniqid(rand(), true);
        
        $saveInfos = (object) [
            'token' => $token,
            'date'  => new DateTime,
            'expire' => $expire
        ];

        $this->saveToken($saveInfos);
        return $saveInfos->token;
    }
public function createToken ( int $ expire = 15 ) : string { $ token = uniqid ( rand ( ) , true ) ; $ saveInfos = ( object ) [ 'token' => $ token , 'date' => new DateTime , 'expire' => $ expire ] ; $ this -> saveToken ( $ saveInfos ) ; return $ saveInfos -> token ; }
Create a token for the form and return the token

@param int $expire (default 15) time on minute during which the
token is valid

@return string

@throws \Exception If the form id is undefined
Create a token for the form and return the token