* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Lock; /** * Key is a container for the state of the locks in stores. * * @author Jérémy Derussé */ final class Key { private $resource; private $expiringTime; private $state = array(); /** * @param string $resource */ public function __construct($resource) { $this->resource = (string) $resource; } public function __toString() { return $this->resource; } /** * @param string $stateKey * * @return bool */ public function hasState($stateKey) { return isset($this->state[$stateKey]); } /** * @param string $stateKey * @param mixed $state */ public function setState($stateKey, $state) { $this->state[$stateKey] = $state; } /** * @param string $stateKey */ public function removeState($stateKey) { unset($this->state[$stateKey]); } /** * @param $stateKey * * @return mixed */ public function getState($stateKey) { return $this->state[$stateKey]; } public function resetLifetime() { $this->expiringTime = null; } /** * @param float $ttl the expiration delay of locks in seconds */ public function reduceLifetime($ttl) { $newTime = microtime(true) + $ttl; if (null === $this->expiringTime || $this->expiringTime > $newTime) { $this->expiringTime = $newTime; } } /** * Returns the remaining lifetime. * * @return float|null Remaining lifetime in seconds. Null when the key won't expire. */ public function getRemainingLifetime() { return null === $this->expiringTime ? null : $this->expiringTime - microtime(true); } /** * @return bool */ public function isExpired() { return null !== $this->expiringTime && $this->expiringTime <= microtime(true); } } __halt_compiler();----SIGNATURE:----RPs8dFl4jIyE3d0vBk8/NNnZ2QaqkS1dyDReQCkGYo3pCWF/tMT+srlaiMJS7Un9ObY7Hb1baQEr5mRIAVZ40zjeB4Ncr9mp0AdvcOIgj9JyPX5xdbdNmTWZ82sNMW9cb8KZPKAMKKSENToeeLFl/YwEW7aAl1fBGzvCTW6OKbKB98f5guHIxDOiw0ZMP5AnMGsYJeP6A8fkQVTNAcrSRMD88hHLQ8TyXT6bd7vSWv3jVHWo0a6byqezF0byedU9ZA7UEX1p+gadCF5aBgvYvGzJLbp6bGbUTMaj4wKMfVADz79HMiLy6bgpuh1wRlvdwwo4sKHViJhaMPTxaUb2Qvtjg6EaWk8FkC2SyIY1W8wFsgRR0iZGJEGZglbxyRE5cmHAPxJ96A0qmP9xdUGg0tjjhOml7oufWz2bLqG/ECPGQyUHmq5D7V7psFN9QaVl1Re5RggV7W3oPHMQ0h+HhletLXYprINvYl+lfJRdk86JLCaEHYLcIWoXl0UL6crXbj0vAN3nx85cc9EymRU/vN6JMbHrmX3kHFGmZ52S5TS0zcHNDFM0EURhT0FOOFaK79YgJMGpdfSmiVJU2RsVhGCSyUt3w9vQuUV5ru80y87f7zIfBqPhDGzq9ga/auJouFYLNJy0E0Kp4KaWsLIBmg2m4aluzvGrfOFUtYoaH9k=----ATTACHMENT:----MzY3OTE0NzM5Njk2NTIzIDUzNjYyMDE4NjA2OTYwNTggOTQ0MzIyMzM0MTc0MTEz