Total Complexity | 3 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
18 | final class Synchronizer |
||
19 | { |
||
20 | private MutexFactoryInterface $mutexFactory; |
||
21 | |||
22 | public function __construct(MutexFactoryInterface $mutexFactory) |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Executes a PHP callable with a lock and returns the result. |
||
29 | * |
||
30 | * @param string $name Name of the mutex to acquire. |
||
31 | * @param callable $callback PHP callable to execution. |
||
32 | * @param int $timeout Time (in seconds) to wait for lock to be released. Defaults to zero meaning that |
||
33 | * method {@see MutexInterface::acquire()} will return false immediately in case lock was already acquired. |
||
34 | * |
||
35 | * @return mixed The result of the PHP callable execution. |
||
36 | */ |
||
37 | public function execute(string $name, callable $callback, int $timeout = 0) |
||
51 |