1 | <?php |
||
7 | class Lock |
||
8 | { |
||
9 | /** |
||
10 | * Lock path. If not set, the system temporary directory is used. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $path; |
||
15 | |||
16 | /** |
||
17 | * Lock name. |
||
18 | * |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $name; |
||
22 | |||
23 | /** |
||
24 | * @var Process |
||
25 | */ |
||
26 | protected $process; |
||
27 | |||
28 | /** |
||
29 | * @param string $name |
||
30 | * @param Process $process |
||
31 | */ |
||
32 | public function __construct(string $name, Process $process = null) |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getPath(): string |
||
54 | |||
55 | /** |
||
56 | * @param string $path |
||
57 | */ |
||
58 | public function setPath(string $path) |
||
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getName(): string |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getFileName(): string |
||
78 | |||
79 | /** |
||
80 | * @return bool |
||
81 | */ |
||
82 | public function isLocked(): bool |
||
100 | |||
101 | /** |
||
102 | * @throws LockException |
||
103 | */ |
||
104 | public function acquire() |
||
110 | |||
111 | /** |
||
112 | * @throws LockException |
||
113 | */ |
||
114 | public function release() |
||
124 | |||
125 | /** |
||
126 | * @throws LockException |
||
127 | */ |
||
128 | public function forceRelease() |
||
148 | } |
||
149 |