* * 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:----g7w23Cntxz6XAYFywHJGVjHLYH1+jjOt4Gq6iVgohPYqPoMti0aUD2cuvc18Z55l9f+RYbi8aLJQREeoTiERzn6xE5oMY3umNo02KxZFJ3ZmrP1p8HBLuccLjdf9shul0/dOYPWO+e29QVvxgiRD3sIL1edBj5LfjOcDPuHhFbVcSI9VsGyMZaeqpKsbh3n0YBBIkxNJn3XplXGH8rY0KHKLmL9RBzM1GBRvGS7olwJtt+gwL99KGpVK/BUM4XScXodK60u1fWLbouUqhC6zKE2ym+Nw/VAyNd3VmZEOMsCX1p+I9WGUm5/4f8MnoR/2oybkGoQhtnUu1Opz1ec/g7XLFzUtTOSQVEv/NDOa5JRYBjm8CcGRuBPOjeZEXHtk64EODRuBixEhNdfrsUHOVb1sDm0uBzMqKvLaRridWsxaOE7a5P7EDCdy/Fx1DKMNpsPDNY6aKpI+wuadPklc4AFLjWyw37Zjy327cMjexQQQz7lAoLAtUPRdhSJr3KzCB4amrO/BzFS0Rp/odi3KEDdtoEXChPNEwL++oD0MkuACd4U2YGbUasq6nBI+cqRGiF3OkZiW8Ea/ai6gQz8uglkJjBHiM8MnG/7tQbIt0kRRE7lJsaEdkiWSp+BIABEEsSHEZkfZQmjw8iZyJk1e4tzn7fLXKShhcP8RGUQg7ys=----ATTACHMENT:----Nzc4OTg1ODg4OTQ2ODU4NiA1MjY5NDc5NDQ5MzE2NTM2IDY4NTEwMDEzMDEwNTg1Mjg=