summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Carlos Ribeiro <acr@antoniocarlosribeiro.com>2017-06-17 01:35:21 -0300
committerAntonio Carlos Ribeiro <acr@antoniocarlosribeiro.com>2017-06-17 01:35:21 -0300
commit0318b4556ffb43536fe16f4aa8dcbdabdac2b67f (patch)
treec6d596435eadde1f411524d39e2fe8639fb83a0a
parent598e848338acc1890dd7cce5436737b72cd80211 (diff)
downloadgoogle2fa-0318b4556ffb43536fe16f4aa8dcbdabdac2b67f.zip
google2fa-0318b4556ffb43536fe16f4aa8dcbdabdac2b67f.tar.gz
google2fa-0318b4556ffb43536fe16f4aa8dcbdabdac2b67f.tar.bz2
Change to return int
-rw-r--r--src/Google2FA.php2
-rw-r--r--tests/spec/Google2FASpec.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/Google2FA.php b/src/Google2FA.php
index 9f91d3b..06c1d5f 100644
--- a/src/Google2FA.php
+++ b/src/Google2FA.php
@@ -163,7 +163,7 @@ class Google2FA implements Google2FAContract
**/
public function getTimestamp()
{
- return floor(microtime(true) / $this->keyRegeneration);
+ return (int) floor(microtime(true) / $this->keyRegeneration);
}
/**
diff --git a/tests/spec/Google2FASpec.php b/tests/spec/Google2FASpec.php
index b59dbad..422c2ff 100644
--- a/tests/spec/Google2FASpec.php
+++ b/tests/spec/Google2FASpec.php
@@ -116,7 +116,7 @@ class Google2FASpec extends ObjectBehavior
},
'beValidTimestamp' => function ($timestamp) {
- return is_float($timestamp)
+ return is_int($timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
},