private function getToken($card, $key = null) { if ($key != null and $key != "") { $this->publicKey = $key; } else { $this->publicKey = TestServicesConfig::validMultiUsePublicKey(); } $this->tokenService = new HpsTokenService($this->publicKey); $tokenResponse = $this->tokenService->getToken($card); if (isset($tokenResponse->token_value)) { $token = new HpsTokenData(); $token->tokenValue = $tokenResponse->token_value; return $token; } else { return $tokenResponse; } }