@@ -28,16 +28,16 @@ class CustomAttributeConditionEvaluator
28
28
29
29
const EXACT_MATCH_TYPE = 'exact ' ;
30
30
const EXISTS_MATCH_TYPE = 'exists ' ;
31
- const GREATER_THAN_MATCH_TYPE = 'gt ' ;
32
31
const GREATER_THAN_EQUAL_TO_MATCH_TYPE = 'ge ' ;
33
- const LESS_THAN_MATCH_TYPE = 'lt ' ;
32
+ const GREATER_THAN_MATCH_TYPE = 'gt ' ;
34
33
const LESS_THAN_EQUAL_TO_MATCH_TYPE = 'le ' ;
35
- const SUBSTRING_MATCH_TYPE = 'substring ' ;
34
+ const LESS_THAN_MATCH_TYPE = 'lt ' ;
36
35
const SEMVER_EQ = 'semver_eq ' ;
37
- const SEMVER_GT = 'semver_gt ' ;
38
36
const SEMVER_GE = 'semver_ge ' ;
39
- const SEMVER_LT = 'semver_lt ' ;
37
+ const SEMVER_GT = 'semver_gt ' ;
40
38
const SEMVER_LE = 'semver_le ' ;
39
+ const SEMVER_LT = 'semver_lt ' ;
40
+ const SUBSTRING_MATCH_TYPE = 'substring ' ;
41
41
42
42
/**
43
43
* @var UserAttributes
@@ -78,9 +78,20 @@ protected function setNullForMissingKeys(array $leafCondition)
78
78
*/
79
79
protected function getMatchTypes ()
80
80
{
81
- return array (self ::EXACT_MATCH_TYPE , self ::EXISTS_MATCH_TYPE , self ::GREATER_THAN_MATCH_TYPE , self ::GREATER_THAN_EQUAL_TO_MATCH_TYPE ,
82
- self ::LESS_THAN_MATCH_TYPE , self ::LESS_THAN_EQUAL_TO_MATCH_TYPE , self ::SUBSTRING_MATCH_TYPE , self ::SEMVER_EQ ,
83
- self ::SEMVER_GT , self ::SEMVER_GE , self ::SEMVER_LT , self ::SEMVER_LE );
81
+ return array (
82
+ self ::EXACT_MATCH_TYPE ,
83
+ self ::EXISTS_MATCH_TYPE ,
84
+ self ::GREATER_THAN_EQUAL_TO_MATCH_TYPE ,
85
+ self ::GREATER_THAN_MATCH_TYPE ,
86
+ self ::LESS_THAN_EQUAL_TO_MATCH_TYPE ,
87
+ self ::LESS_THAN_MATCH_TYPE ,
88
+ self ::SEMVER_EQ ,
89
+ self ::SEMVER_GE ,
90
+ self ::SEMVER_GT ,
91
+ self ::SEMVER_LE ,
92
+ self ::SEMVER_LT ,
93
+ self ::SUBSTRING_MATCH_TYPE ,
94
+ );
84
95
}
85
96
86
97
/**
@@ -95,16 +106,16 @@ protected function getEvaluatorByMatchType($matchType)
95
106
$ evaluatorsByMatchType = array ();
96
107
$ evaluatorsByMatchType [self ::EXACT_MATCH_TYPE ] = 'exactEvaluator ' ;
97
108
$ evaluatorsByMatchType [self ::EXISTS_MATCH_TYPE ] = 'existsEvaluator ' ;
98
- $ evaluatorsByMatchType [self ::GREATER_THAN_MATCH_TYPE ] = 'greaterThanEvaluator ' ;
99
109
$ evaluatorsByMatchType [self ::GREATER_THAN_EQUAL_TO_MATCH_TYPE ] = 'greaterThanEqualToEvaluator ' ;
100
- $ evaluatorsByMatchType [self ::LESS_THAN_MATCH_TYPE ] = 'lessThanEvaluator ' ;
110
+ $ evaluatorsByMatchType [self ::GREATER_THAN_MATCH_TYPE ] = 'greaterThanEvaluator ' ;
101
111
$ evaluatorsByMatchType [self ::LESS_THAN_EQUAL_TO_MATCH_TYPE ] = 'lessThanEqualToEvaluator ' ;
102
- $ evaluatorsByMatchType [self ::SUBSTRING_MATCH_TYPE ] = 'substringEvaluator ' ;
112
+ $ evaluatorsByMatchType [self ::LESS_THAN_MATCH_TYPE ] = 'lessThanEvaluator ' ;
103
113
$ evaluatorsByMatchType [self ::SEMVER_EQ ] = 'semverEqualEvaluator ' ;
104
- $ evaluatorsByMatchType [self ::SEMVER_GT ] = 'semverGreaterThanEvaluator ' ;
105
114
$ evaluatorsByMatchType [self ::SEMVER_GE ] = 'semverGreaterThanEqualToEvaluator ' ;
106
- $ evaluatorsByMatchType [self ::SEMVER_LT ] = 'semverLessThanEvaluator ' ;
115
+ $ evaluatorsByMatchType [self ::SEMVER_GT ] = 'semverGreaterThanEvaluator ' ;
107
116
$ evaluatorsByMatchType [self ::SEMVER_LE ] = 'semverLessThanEqualToEvaluator ' ;
117
+ $ evaluatorsByMatchType [self ::SEMVER_LT ] = 'semverLessThanEvaluator ' ;
118
+ $ evaluatorsByMatchType [self ::SUBSTRING_MATCH_TYPE ] = 'substringEvaluator ' ;
108
119
109
120
return $ evaluatorsByMatchType [$ matchType ];
110
121
}
@@ -126,13 +137,13 @@ protected function isValueTypeValidForExactConditions($value)
126
137
}
127
138
128
139
/**
129
- * returns result of SemVersionConditionEvaluator::compareVersion for given target and user versions.
140
+ * Returns result of SemVersionConditionEvaluator::compareVersion for given target and user versions.
130
141
*
131
142
* @param object $condition
132
143
*
133
- * @return null|int 0 if user's semver attribute is equal to the semver condition value,
134
- * 1 if user's semver attribute is greater than the semver condition value,
135
- * -1 if user's semver attribute is less than the semver condition value,
144
+ * @return null|int 0 if user's version attribute is equal to the semver condition value,
145
+ * 1 if user's version attribute is greater than the semver condition value,
146
+ * -1 if user's version attribute is less than the semver condition value,
136
147
* null if the condition value or user attribute value has an invalid type, or
137
148
* if there is a mismatch between the user attribute type and the condition
138
149
* value type.
@@ -444,9 +455,9 @@ protected function substringEvaluator($condition)
444
455
*
445
456
* @param object $condition
446
457
*
447
- * @return boolean true if user's semver attribute is equal to the semver condition value,
448
- * false if the user's semver is greater or less than the semver condition value,
449
- * null if the semver condition value or user's semver attribute is invalid.
458
+ * @return boolean true if user's version attribute is equal to the semver condition value,
459
+ * false if the user's version attribute is greater or less than the semver condition value,
460
+ * null if the semver condition value or user's version attribute is invalid.
450
461
*/
451
462
protected function semverEqualEvaluator ($ condition )
452
463
{
@@ -462,9 +473,9 @@ protected function semverEqualEvaluator($condition)
462
473
*
463
474
* @param object $condition
464
475
*
465
- * @return boolean true if user's semver attribute is greater than the semver condition value,
466
- * false if the user's semver is less than or equal to the semver condition value,
467
- * null if the semver condition value or user's semver attribute is invalid.
476
+ * @return boolean true if user's version attribute is greater than the semver condition value,
477
+ * false if the user's version attribute is less than or equal to the semver condition value,
478
+ * null if the semver condition value or user's version attribute is invalid.
468
479
*/
469
480
protected function semverGreaterThanEvaluator ($ condition )
470
481
{
@@ -480,9 +491,9 @@ protected function semverGreaterThanEvaluator($condition)
480
491
*
481
492
* @param object $condition
482
493
*
483
- * @return boolean true if user's semver attribute is greater than or equal to the semver condition value,
484
- * false if the user's semver is less than the semver condition value,
485
- * null if the semver condition value or user's semver attribute is invalid.
494
+ * @return boolean true if user's version attribute is greater than or equal to the semver condition value,
495
+ * false if the user's version attribute is less than the semver condition value,
496
+ * null if the semver condition value or user's version attribute is invalid.
486
497
*/
487
498
protected function semverGreaterThanEqualToEvaluator ($ condition )
488
499
{
@@ -498,9 +509,9 @@ protected function semverGreaterThanEqualToEvaluator($condition)
498
509
*
499
510
* @param object $condition
500
511
*
501
- * @return boolean true if user's semver attribute is less than the semver condition value,
502
- * false if the user's semver is greater than or equal to the semver condition value,
503
- * null if the semver condition value or user's semver attribute is invalid.
512
+ * @return boolean true if user's version attribute is less than the semver condition value,
513
+ * false if the user's version attribute is greater than or equal to the semver condition value,
514
+ * null if the semver condition value or user's version attribute is invalid.
504
515
*/
505
516
protected function semverLessThanEvaluator ($ condition )
506
517
{
@@ -516,9 +527,9 @@ protected function semverLessThanEvaluator($condition)
516
527
*
517
528
* @param object $condition
518
529
*
519
- * @return boolean true if user's semver attribute is less than or equal to the semver condition value,
520
- * false if the user's semver is greater than the semver condition value,
521
- * null if the semver condition value or user's semver attribute is invalid.
530
+ * @return boolean true if user's version attribute is less than or equal to the semver condition value,
531
+ * false if the user's version attribute is greater than the semver condition value,
532
+ * null if the semver condition value or user's version attribute is invalid.
522
533
*/
523
534
protected function semverLessThanEqualToEvaluator ($ condition )
524
535
{
0 commit comments