| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Lock Data Transfer Object that is stored and retrieved to determine |
| 4 |
* lock state. |
| 5 |
* |
| 6 |
* @package SolidWP\Performance |
| 7 |
*/ |
| 8 |
|
| 9 |
declare( strict_types=1 ); |
| 10 |
|
| 11 |
namespace SolidWP\Performance\Lock; |
| 12 |
|
| 13 |
/** |
| 14 |
* The Lock Data Transfer Object that is stored and retrieved to determine |
| 15 |
* lock state. |
| 16 |
* |
| 17 |
* @package SolidWP\Performance |
| 18 |
*/ |
| 19 |
final class Lock_Entry { |
| 20 |
|
| 21 |
/** |
| 22 |
* The unique lock name. |
| 23 |
* |
| 24 |
* @var string |
| 25 |
*/ |
| 26 |
private string $name; |
| 27 |
|
| 28 |
/** |
| 29 |
* The expiration in seconds. |
| 30 |
* |
| 31 |
* @var int |
| 32 |
*/ |
| 33 |
private int $expiration; |
| 34 |
|
| 35 |
/** |
| 36 |
* The owner of the lock. |
| 37 |
* |
| 38 |
* @var string |
| 39 |
*/ |
| 40 |
private string $owner; |
| 41 |
|
| 42 |
/** |
| 43 |
* @param string $name The unique lock name. |
| 44 |
* @param int $expiration The expiration in seconds. |
| 45 |
* @param string $owner The owner of the lock. |
| 46 |
*/ |
| 47 |
public function __construct( string $name, int $expiration, string $owner ) { |
| 48 |
$this->name = $name; |
| 49 |
$this->expiration = $expiration; |
| 50 |
$this->owner = $owner; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Get the lock name. |
| 55 |
* |
| 56 |
* @return string |
| 57 |
*/ |
| 58 |
public function name(): string { |
| 59 |
return $this->name; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Get the lock expiration in seconds. |
| 64 |
* |
| 65 |
* @return int |
| 66 |
*/ |
| 67 |
public function expiration(): int { |
| 68 |
return $this->expiration; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Get the lock owner. |
| 73 |
* |
| 74 |
* @return string |
| 75 |
*/ |
| 76 |
public function owner(): string { |
| 77 |
return $this->owner; |
| 78 |
} |
| 79 |
} |
| 80 |
|