/** * Testing all the getters and setters in the entity class */ public function testGettersAndSetters() { $array = $this->getDummyHmacData(); $this->entity->setData($array['data']); $this->entity->setKey($array['key']); $this->entity->setTime($array['time']); $this->entity->setHmac($array['hmac']); $this->assertTrue($array['data'] === $this->entity->getData()); $this->assertTrue($array['key'] === $this->entity->getKey()); $this->assertTrue($array['time'] === $this->entity->getTime()); $this->assertTrue($array['hmac'] === $this->entity->getHmac()); }
/** * Checks the HMAC key to make sure it is valid * * @param string $hmac * @return boolean */ public function isValid($hmac) { $this->adapter->encode(); if (time() - $this->entity->getTime() >= $this->ttl && $this->ttl != 0 || $hmac != $this->entity->getHmac()) { return false; } return true; }
/** * Checks the HMAC key to make sure it is valid * * @param string $hmac * @return boolean */ public function isValid($hmac) { $this->adapter->encode(); return !(time() - $this->entity->getTime() >= $this->ttl && $this->ttl != 0 || $hmac != $this->entity->getHmac()); }