| 1 | <?php |
||
| 5 | final class Lock |
||
| 6 | { |
||
| 7 | /** @var string */ |
||
| 8 | private $resource; |
||
| 9 | |||
| 10 | /** @var string */ |
||
| 11 | private $token; |
||
| 12 | |||
| 13 | /** @var int */ |
||
| 14 | private $validityEndTime; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Lock constructor. |
||
| 18 | * |
||
| 19 | * @param string $resource The name of the resource to lock |
||
| 20 | * @param string $token The token generated by the Locker |
||
| 21 | */ |
||
| 22 | 72 | public function __construct($resource, $token) |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Get the resource name. |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 63 | public function getResource() |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Get the token associated with the lock. |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 57 | public function getToken() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Set the validity end time (in milliseconds since EPOCH). |
||
| 51 | * |
||
| 52 | * @param int $validityEndTime |
||
| 53 | */ |
||
| 54 | 9 | public function setValidityEndTime($validityEndTime) |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Get the validity end time (in milliseconds since EPOCH). |
||
| 61 | * |
||
| 62 | * @return int |
||
| 63 | */ |
||
| 64 | 18 | public function getValidityEndTime() |
|
| 68 | } |
||
| 69 |