File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ public function verify($payload, $headers)
70
70
71
71
public function sign ($ msgId , $ timestamp , $ payload )
72
72
{
73
- $ is_positive_integer = is_numeric ($ timestamp ) && !is_float ($ timestamp + 0 ) && (int ) $ timestamp == $ timestamp && (int ) $ timestamp > 0 ;
74
- if (!$ is_positive_integer ) {
73
+ if (!self ::isPositiveInteger ($ timestamp )) {
75
74
throw new Exception \WebhookSigningException ("Invalid timestamp " );
76
75
}
77
76
$ toSign = "{$ msgId }. {$ timestamp }. {$ payload }" ;
@@ -97,4 +96,9 @@ private function verifyTimestamp($timestampHeader)
97
96
}
98
97
return $ timestamp ;
99
98
}
99
+
100
+ private function isPositiveInteger ($ v )
101
+ {
102
+ return is_numeric ($ v ) && !is_float ($ v + 0 ) && (int ) $ v == $ v && (int ) $ v > 0 ;
103
+ }
100
104
}
You can’t perform that action at this time.
0 commit comments