Skip to content

Commit 9de6247

Browse files
committed
Release 3.5
1 parent 428a72f commit 9de6247

10 files changed

Lines changed: 527 additions & 281 deletions

IntegrationConfigHelpers.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class IntegrationEvaluator implements IIntegrationEvaluator
1010
{
1111
public function getMatchedIntegrationConfig(array $customerIntegration, $currentPageUrl, $request) {
1212
if (!array_key_exists("Integrations", $customerIntegration) || !is_array($customerIntegration["Integrations"])) {
13-
return NULL;
13+
return null;
1414
}
1515
foreach ($customerIntegration["Integrations"] as $integrationConfig) {
1616
if (!is_array($integrationConfig) || !array_key_exists("Triggers", $integrationConfig) || !is_array($integrationConfig["Triggers"])) {
@@ -26,7 +26,7 @@ public function getMatchedIntegrationConfig(array $customerIntegration, $current
2626
}
2727
}
2828
}
29-
return NULL;
29+
return null;
3030
}
3131

3232
private function evaluateTrigger(array $trigger, $currentPageUrl, $request) {
@@ -92,8 +92,8 @@ public static function evaluate(array $triggerPart, $url) {
9292
$triggerPart["IsNegative"],
9393
$triggerPart["IsIgnoreCase"],
9494
UrlValidatorHelper::GetUrlPart($triggerPart["UrlPart"], $url),
95-
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: NULL,
96-
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: NULL);
95+
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: null,
96+
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: null);
9797
}
9898

9999
private static function GetUrlPart($urlPart, $url) {
@@ -132,8 +132,8 @@ public static function evaluate(array $triggerPart, array $cookieList) {
132132
$triggerPart["IsNegative"],
133133
$triggerPart["IsIgnoreCase"],
134134
$cookieValue,
135-
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: NULL,
136-
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: NULL);
135+
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: null,
136+
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: null);
137137
}
138138
}
139139

@@ -151,8 +151,8 @@ public static function evaluate(array $triggerPart, $userAgent) {
151151
$triggerPart["IsNegative"],
152152
$triggerPart["IsIgnoreCase"],
153153
$userAgent,
154-
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: NULL,
155-
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: NULL);
154+
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: null,
155+
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: null);
156156
}
157157
}
158158

@@ -177,8 +177,8 @@ public static function evaluate(array $triggerPart, array $headerList) {
177177
$triggerPart["IsNegative"],
178178
$triggerPart["IsIgnoreCase"],
179179
$headerValue,
180-
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: NULL,
181-
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: NULL);
180+
array_key_exists("ValueToCompare",$triggerPart)? $triggerPart["ValueToCompare"]: null,
181+
array_key_exists("ValuesToCompare",$triggerPart)? $triggerPart["ValuesToCompare"]: null);
182182
}
183183
}
184184

KnownUser.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@
1212
class KnownUser
1313
{
1414
//used for unittest
15-
private static $userInQueueService = NULL;
15+
private static $userInQueueService = null;
1616
private static function getUserInQueueService() {
17-
if (KnownUser::$userInQueueService == NULL)
17+
if (KnownUser::$userInQueueService == null)
1818
{
1919
return new UserInQueueService(new UserInQueueStateCookieRepository(KnownUser::getHttpRequestProvider()->getCookieManager()));
2020
}
2121
return KnownUser::$userInQueueService;
2222
}
2323

2424
//used for unittest
25-
private static $httpRequestProvider= NULL;
25+
private static $httpRequestProvider= null;
2626
private static function getHttpRequestProvider() {
27-
if (KnownUser::$httpRequestProvider == NULL)
27+
if (KnownUser::$httpRequestProvider == null)
2828
{
2929
return new HttpRequestProvider();
3030
}
3131
return KnownUser::$httpRequestProvider;
3232
}
33-
private static $debugInfoArray=NULL;
33+
private static $debugInfoArray=null;
3434
public static function extendQueueCookie($eventId, $cookieValidityMinute, $cookieDomain, $secretKey) {
3535
if (empty($eventId)) {
3636
throw new KnownUserException("eventId can not be null or empty.");
@@ -151,14 +151,13 @@ public static function validateRequestByIntegrationConfig($currentUrlWithoutQueu
151151

152152
if ($isDebug)
153153
{
154-
$dic = array("MatchedConfig"=>(($matchedConfig !=NULL) ? $matchedConfig["Name"]:"NULL"));
154+
$dic = array("MatchedConfig"=>(($matchedConfig !=null) ? $matchedConfig["Name"]:"NULL"));
155155
KnownUser::doCookieLog($dic);
156156
}
157157

158-
if ($matchedConfig == NULL) {
159-
return new RequestValidationResult(NULL,NULL, NULL, NULL);
160-
}
161-
158+
if ($matchedConfig == null) {
159+
return new RequestValidationResult(null, null, null, null, null);
160+
}
162161

163162
if(!array_key_exists("ActionType",$matchedConfig) || $matchedConfig["ActionType"]== ActionTypes::QueueAction)
164163
{
@@ -245,7 +244,7 @@ private static function logMoreRequestDetails(array &$debugInfos)
245244

246245
private static function doCookieLog(array $debugInfos)
247246
{
248-
if(KnownUser::$debugInfoArray !=NULL)
247+
if(KnownUser::$debugInfoArray !=null)
249248
{
250249
foreach (KnownUser::$debugInfoArray as $key => $value)
251250
{
@@ -261,7 +260,7 @@ private static function doCookieLog(array $debugInfos)
261260
array_push( $cookieNameValues, $key.'='.$value);
262261
}
263262

264-
KnownUser::getHttpRequestProvider()->getCookieManager()->setCookie("queueitdebug", implode('|', $cookieNameValues ), 0, NULL);
263+
KnownUser::getHttpRequestProvider()->getCookieManager()->setCookie("queueitdebug", implode('|', $cookieNameValues ), 0, null);
265264
KnownUser::$debugInfoArray = $debugInfos;
266265
}
267266

@@ -290,10 +289,10 @@ public function getCookie($cookieName) {
290289
}
291290

292291
public function setCookie($name, $value, $expire, $domain) {
293-
if ($domain == NULL) {
292+
if ($domain == null) {
294293
$domain = "";
295294
}
296-
setcookie($name, $value, $expire, "/", $domain, false, true);
295+
setcookie($name, $value, $expire, "/", $domain, false, false);
297296
}
298297
public function getCookieArray() {
299298
$arryCookie = array();
@@ -329,7 +328,7 @@ function getUserHostAddress()
329328

330329
function getCookieManager()
331330
{
332-
if($this->cookieManager==NULL)
331+
if($this->cookieManager==null)
333332
{
334333
$this->cookieManager = new CookieManager();
335334
}
@@ -351,7 +350,7 @@ function getAbsoluteUri()
351350
}
352351
function getHeaderArray()
353352
{
354-
if($this->allHeadersLowerCaseKeyArray == NULL)
353+
if($this->allHeadersLowerCaseKeyArray == null)
355354
{
356355
$tempArray=array();
357356
foreach( getallheaders() as $key=>$value)

Models.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public static function isNullOrEmptyString($value){
77
return (!isset($value) || trim($value)==='');
88
}
99
}
10+
1011
class QueueEventConfig
1112
{
1213
public $eventId;
@@ -23,7 +24,6 @@ public function getString()
2324
."&QueueDomain:".$this->queueDomain ."&CookieDomain:".$this->cookieDomain. "&ExtendCookieValidity:".$this->extendCookieValidity
2425
."&CookieValidityMinute:" .$this->cookieValidityMinute."&LayoutName:".$this->layoutName."&Culture:".$this->culture;
2526
}
26-
2727
}
2828

2929
class CancelEventConfig
@@ -38,18 +38,21 @@ public function getString()
3838
."&QueueDomain:".$this->queueDomain ."&CookieDomain:".$this->cookieDomain;
3939
}
4040
}
41+
4142
class RequestValidationResult
4243
{
4344
public $eventId;
4445
public $redirectUrl;
4546
public $queueId;
4647
public $actionType;
48+
public $redirectType;
4749

48-
function __construct($actionType ,$eventId, $queueId, $redirectUrl) {
49-
$this->actionType= $actionType;
50-
$this->eventId= $eventId;
51-
$this->queueId= $queueId;
50+
function __construct($actionType, $eventId, $queueId, $redirectUrl, $redirectType) {
51+
$this->actionType = $actionType;
52+
$this->eventId = $eventId;
53+
$this->queueId = $queueId;
5254
$this->redirectUrl = $redirectUrl;
55+
$this->redirectType = $redirectType;
5356
}
5457

5558
public function doRedirect() {
@@ -63,6 +66,7 @@ function __construct($message, $code = 0) {
6366
parent::__construct($message, $code);
6467
}
6568
}
69+
6670
class ActionTypes
6771
{
6872
const QueueAction="Queue" ;

QueueITHelpers.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class QueueUrlParams {
66

77
const TimeStampKey = "ts";
88
const ExtendableCookieKey = "ce";
9-
const CookieValidityMinuteKey = "cv";
9+
const CookieValidityMinutesKey = "cv";
1010
const HashKey = "h";
1111
const EventIdKey = "e";
1212
const QueueIdKey = "q";
@@ -18,7 +18,7 @@ class QueueUrlParams {
1818
public $eventId = "";
1919
public $hashCode = "";
2020
public $extendableCookie = false;
21-
public $cookieValidityMinute = null;
21+
public $cookieValidityMinutes = null;
2222
public $queueITToken = "";
2323
public $queueITTokenWithoutHash = "";
2424
public $queueId = "";
@@ -42,9 +42,9 @@ public static function extractQueueParams($queueitToken) {
4242
}
4343
break;
4444
}
45-
case QueueUrlParams::CookieValidityMinuteKey: {
45+
case QueueUrlParams::CookieValidityMinutesKey: {
4646
if (is_numeric($paramNameValueArr[1])) {
47-
$result->cookieValidityMinute = intval($paramNameValueArr[1]);
47+
$result->cookieValidityMinutes = intval($paramNameValueArr[1]);
4848
}
4949
break;
5050
}

Tests/KnownUserTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function validateCancelRequest(
9898

9999
public function getIgnoreActionResult() {
100100
array_push($this->arrayFunctionCallsArgs['getIgnoreActionResult'], "call");
101-
return new QueueIT\KnownUserV3\SDK\RequestValidationResult( QueueIT\KnownUserV3\SDK\ActionTypes::IgnoreAction,NULL,NULL,NULL);;
101+
return new QueueIT\KnownUserV3\SDK\RequestValidationResult(QueueIT\KnownUserV3\SDK\ActionTypes::IgnoreAction, null, null, null, null);
102102
}
103103

104104
public function extendQueueCookie(
@@ -731,7 +731,7 @@ function test_validateRequestByIntegrationConfig_CancelAction()
731731
$r = new ReflectionProperty('QueueIT\KnownUserV3\SDK\KnownUser', 'userInQueueService');
732732
$r->setAccessible(true);
733733
$r->setValue(null, $userInQueueservice);
734-
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel","eventid","queueid","redirectUrl");
734+
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel", "eventid", "queueid", "redirectUrl", null);
735735

736736
$var = "some text";
737737
$integrationConfigString = <<<EOT
@@ -850,7 +850,7 @@ function test_validateRequestByIntegrationConfig_debug()
850850
$r = new ReflectionProperty('QueueIT\KnownUserV3\SDK\KnownUser', 'httpRequestProvider');
851851
$r->setAccessible(true);
852852
$r->setValue(null, $httpRequestProvider);
853-
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel","eventid","redirectUrl","queueid");
853+
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel", "eventid", "queueid", "redirectUrl", null);
854854

855855
$var = "some text";
856856
$integrationConfigString = <<<EOT
@@ -931,7 +931,7 @@ function test_validateRequestByIntegrationConfig_withoutmatch_debug()
931931
$r->setAccessible(true);
932932
$r->setValue(null, NULL);
933933

934-
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel","eventid","redirectUrl","queueid");
934+
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel", "eventid", "queueid", "redirectUrl", null);
935935

936936
$integrationConfigString = <<<EOT
937937
{
@@ -1008,7 +1008,7 @@ function test_validateRequestByIntegrationConfig_notvalidhash_debug()
10081008
$r->setAccessible(true);
10091009
$r->setValue(null, NULL);
10101010

1011-
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel","eventid","redirectUrl","queueid");
1011+
$userInQueueservice->validateCancelRequestResult = new QueueIT\KnownUserV3\SDK\RequestValidationResult("Cancel", "eventid", "queueid", "redirectUrl", null);
10121012

10131013
$integrationConfigString = <<<EOT
10141014
{

Tests/QueueUrlParamsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function test_ExtractQueueParams() {
1111
$this->assertTrue($result->timeStamp===1486645251);
1212
$this->assertTrue($result->extendableCookie===true);
1313
$this->assertTrue($result->queueITToken===$queueITToken);
14-
$this->assertTrue($result->cookieValidityMinute===3);
14+
$this->assertTrue($result->cookieValidityMinutes===3);
1515
$this->assertTrue($result->queueId==="6cf23f10-aca7-4fa2-840e-e10f56aecb44");
1616
$this->assertTrue($result->hashCode==="cb7b7b53fa20e708cb59a5a2696f248cba3b2905d92e12ee5523c298adbef298");
1717
$this->assertTrue($result->queueITTokenWithoutHash==="e_testevent1~q_6cf23f10-aca7-4fa2-840e-e10f56aecb44~ts_1486645251~ce_True~cv_3~rt_Queue");
@@ -23,7 +23,7 @@ function test_ExtractQueueParams_NotValidToken() {
2323
$this->assertTrue($result->timeStamp===0);
2424
$this->assertTrue($result->extendableCookie===false);
2525
$this->assertTrue($result->queueITToken===$queueITToken);
26-
$this->assertTrue($result->cookieValidityMinute===null);
26+
$this->assertTrue($result->cookieValidityMinutes===null);
2727
$this->assertTrue($result->hashCode==="");
2828
$this->assertTrue($result->queueITTokenWithoutHash==="ts_sasa~cv_adsasa~ce_falwwwse~q_944c1f44-60dd-4e37-aabc-f3e4bb1c8895");
2929
}

0 commit comments

Comments
 (0)